Skip to content

Commit 3b68d34

Browse files
committed
Fix test logic and naming #1810
1 parent 5a35146 commit 3b68d34

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/Tests/ClientConcepts/ConnectionPooling/Sticky/Sticky.doc.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ namespace Tests.ClientConcepts.ConnectionPooling.Sticky
1111
{
1212
public class Sticky
1313
{
14+
/** Sticky
15+
* Each connection pool returns the first `live` node so that it is sticky between requests
16+
*/
17+
1418
protected int NumberOfNodes = 10;
1519

16-
[U] public void EachViewStartsAtNexPositionAndWrapsOver()
20+
[U] public void EachViewStartsAtNextPositionAndWrapsOver()
1721
{
1822
var uris = Enumerable.Range(9200, NumberOfNodes).Select(p => new Uri("http://localhost:" + p));
1923
var staticPool = new StickyConnectionPool(uris);
@@ -23,12 +27,20 @@ [U] public void EachViewStartsAtNexPositionAndWrapsOver()
2327

2428
public void AssertCreateView(StickyConnectionPool pool)
2529
{
30+
/**
31+
* Here we have setup a static connection pool seeded with 10 nodes.
32+
* So what order we expect? Imagine the following:
33+
*
34+
* Thread A calls GetNext and gets returned the first live node
35+
* Thread B calls GetNext() and gets returned the same node as it's still the first live.
36+
*/
37+
2638
var startingPositions = Enumerable.Range(0, NumberOfNodes)
2739
.Select(i => pool.CreateView().First())
2840
.Select(n => n.Uri.Port)
2941
.ToList();
3042

31-
var expectedOrder = Enumerable.Range(9200, NumberOfNodes);
43+
var expectedOrder = Enumerable.Repeat(9200, NumberOfNodes);
3244
startingPositions.Should().ContainInOrder(expectedOrder);
3345
}
3446
}

0 commit comments

Comments
 (0)