From 6dc4b0b74997ef0a711d2a4199dd8471f2d5537c Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Thu, 20 Oct 2016 12:43:51 -0700 Subject: [PATCH] x-plugins side of zen ping refactoring see elastic/elasticsearchelastic/elasticsearch#21049 Original commit: elastic/x-pack-elasticsearch@57a0405eb73b76548dcd8c0bad132adc0f8de6dd --- .../watcher/test/integration/NoMasterNodeTests.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/test/integration/NoMasterNodeTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/test/integration/NoMasterNodeTests.java index 99b8da469e2..da9f40357e2 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/test/integration/NoMasterNodeTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/test/integration/NoMasterNodeTests.java @@ -16,7 +16,6 @@ import org.elasticsearch.discovery.MasterNotDiscoveredException; import org.elasticsearch.discovery.zen.ElectMasterService; import org.elasticsearch.discovery.zen.UnicastZenPing; import org.elasticsearch.discovery.zen.ZenPing; -import org.elasticsearch.discovery.zen.ZenPingService; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.discovery.ClusterDiscoveryConfiguration; import org.elasticsearch.test.junit.annotations.TestLogging; @@ -227,12 +226,9 @@ public class NoMasterNodeTests extends AbstractWatcherIntegrationTestCase { // will elect itself as master. This is bad and should be fixed in core. What I think that should happen is that // if a node detects that is has lost a node, a node should clear its unicast temporal responses or at least // remove the node that has been removed. This is a workaround: - for (ZenPingService pingService : internalCluster().getInstances(ZenPingService.class)) { - for (ZenPing zenPing : pingService.zenPings()) { - if (zenPing instanceof UnicastZenPing) { - ((UnicastZenPing) zenPing).clearTemporalResponses(); - } - } + ZenPing zenPing = internalCluster().getInstance(ZenPing.class); + if (zenPing instanceof UnicastZenPing) { + ((UnicastZenPing) zenPing).clearTemporalResponses(); } internalCluster().stopCurrentMasterNode(); // Can't use ensureWatcherStopped, b/c that relies on the watcher stats api which requires an elected master node