File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
src/Tests/ClientConcepts/ConnectionPooling/Sticky Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Concurrent ;
3+ using System . Collections . Generic ;
4+ using System . Linq ;
5+ using System . Threading ;
6+ using Elasticsearch . Net ;
7+ using FluentAssertions ;
8+ using Tests . Framework ;
9+
10+ namespace Tests . ClientConcepts . ConnectionPooling . Sticky
11+ {
12+ public class Sticky
13+ {
14+ protected int NumberOfNodes = 10 ;
15+
16+ [ U ] public void EachViewStartsAtNexPositionAndWrapsOver ( )
17+ {
18+ var uris = Enumerable . Range ( 9200 , NumberOfNodes ) . Select ( p => new Uri ( "http://localhost:" + p ) ) ;
19+ var staticPool = new StickyConnectionPool ( uris ) ;
20+
21+ this . AssertCreateView ( staticPool ) ;
22+ }
23+
24+ public void AssertCreateView ( StickyConnectionPool pool )
25+ {
26+ var startingPositions = Enumerable . Range ( 0 , NumberOfNodes )
27+ . Select ( i => pool . CreateView ( ) . First ( ) )
28+ . Select ( n => n . Uri . Port )
29+ . ToList ( ) ;
30+
31+ var expectedOrder = Enumerable . Range ( 9200 , NumberOfNodes ) ;
32+ startingPositions . Should ( ) . ContainInOrder ( expectedOrder ) ;
33+ }
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments