From 207feb2fa2716440eba4c0d7332304fc4a0ea117 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Mon, 14 Nov 2016 23:27:02 -0800 Subject: [PATCH] Fix test lookup of Discovery to cast instead of lookup in injector directly Original commit: elastic/x-pack-elasticsearch@2718dab928fa8b9c9a18e0e234d56f5b48fa819e --- .../xpack/watcher/test/integration/NoMasterNodeTests.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 2f0c258f554..1b0d41b8c53 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 @@ -11,6 +11,7 @@ import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; +import org.elasticsearch.discovery.Discovery; import org.elasticsearch.discovery.DiscoverySettings; import org.elasticsearch.discovery.MasterNotDiscoveredException; import org.elasticsearch.discovery.zen.ElectMasterService; @@ -75,6 +76,7 @@ public class NoMasterNodeTests extends AbstractWatcherIntegrationTestCase { .put(settings) .put(unicastSettings) .put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), 2) + .put(TestZenDiscovery.USE_MOCK_PINGS.getKey(), false) .build(); } @@ -228,7 +230,7 @@ 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: - ZenPing zenPing = internalCluster().getInstance(TestZenDiscovery.class).getZenPing(); + ZenPing zenPing = ((TestZenDiscovery)internalCluster().getInstance(Discovery.class)).getZenPing(); if (zenPing instanceof UnicastZenPing) { ((UnicastZenPing) zenPing).clearTemporalResponses(); }