@@ -56,5 +56,46 @@ public void SniffOnFaultShouldGetCleanClusterState()
5656
5757 }
5858
59+ [ Test ]
60+ public async void SniffOnFaultShouldGetCleanClusterState_Async ( )
61+ {
62+ var seeds = new [ ]
63+ {
64+ new Uri ( "http://localhost:9202" ) ,
65+ new Uri ( "http://localhost:9201" ) ,
66+ new Uri ( "http://localhost:9200" ) ,
67+ } ;
68+ var sniffingConnectionPool = new SniffingConnectionPool ( seeds , randomizeOnStartup : false ) ;
69+ var connectionSettings = new ConnectionSettings ( sniffingConnectionPool )
70+ . SniffOnConnectionFault ( ) ;
71+
72+ var client = new ElasticClient ( connectionSettings ) ;
73+ var rootNode = await client . RootNodeInfoAsync ( ) ;
74+ var metrics = rootNode . ConnectionStatus . Metrics ;
75+
76+ metrics . Requests . Count . Should ( ) . Be ( 5 ) ;
77+ metrics . Requests [ 0 ] . Node . Port . Should ( ) . Be ( 9202 ) ;
78+ metrics . Requests [ 0 ] . RequestType . Should ( ) . Be ( RequestType . Ping ) ;
79+ metrics . Requests [ 1 ] . Node . Port . Should ( ) . Be ( 9201 ) ;
80+ metrics . Requests [ 1 ] . RequestType . Should ( ) . Be ( RequestType . Ping ) ;
81+ metrics . Requests [ 2 ] . Node . Port . Should ( ) . Be ( 9200 ) ;
82+ metrics . Requests [ 2 ] . RequestType . Should ( ) . Be ( RequestType . Ping ) ;
83+ metrics . Requests [ 3 ] . Node . Port . Should ( ) . Be ( 9200 ) ;
84+ metrics . Requests [ 3 ] . RequestType . Should ( ) . Be ( RequestType . Sniff ) ;
85+
86+ metrics . Requests [ 4 ] . Node . Port . Should ( ) . Be ( 9200 ) ;
87+ metrics . Requests [ 4 ] . RequestType . Should ( ) . Be ( RequestType . ElasticsearchCall ) ;
88+
89+
90+ for ( var i = 0 ; i < 3 ; i ++ )
91+ {
92+ rootNode = await client . RootNodeInfoAsync ( ) ;
93+ metrics = rootNode . ConnectionStatus . Metrics ;
94+ metrics . Requests . Count . Should ( ) . Be ( 1 ) ;
95+ metrics . Requests [ 0 ] . Node . Port . Should ( ) . Be ( 9200 ) ;
96+ metrics . Requests [ 0 ] . RequestType . Should ( ) . Be ( RequestType . ElasticsearchCall ) ;
97+ }
98+
99+ }
59100 }
60101}
0 commit comments