Skip to content

Commit 14c5409

Browse files
committed
renamed failover integration tests to better describe what they are doing, added an async test for sniff on fault integration test
1 parent ce11fa7 commit 14c5409

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

src/Tests/Nest.Tests.Integration/Failover/FailoverSniffOnFaultTests.cs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

src/Tests/Nest.Tests.Integration/Failover/FailoverSniffOnStartupTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Nest.Tests.Integration.Failover
1515
public class FailoverSniffOnStartupTests
1616
{
1717
[Test]
18-
public void FailoverShouldOnlyPingDeadNodes()
18+
public void SniffOnStartShouldOnlyHit9200_WithoutPing()
1919
{
2020
var seeds = new[]
2121
{
@@ -48,7 +48,7 @@ public void FailoverShouldOnlyPingDeadNodes()
4848
}
4949

5050
[Test]
51-
public async void FailoverShouldOnlyPingDeadNodes_Async()
51+
public async void SniffOnStartShouldOnlyHit9200_WithoutPing_Async()
5252
{
5353
var seeds = new[]
5454
{

0 commit comments

Comments
 (0)