Fix test to use TestZenDiscovery to get access to pings

Original commit: elastic/x-pack-elasticsearch@83ea58c2dd
This commit is contained in:
Ryan Ernst 2016-11-14 22:09:19 -08:00
parent 96ba09436e
commit 190c036932
1 changed files with 2 additions and 1 deletions

View File

@ -19,6 +19,7 @@ import org.elasticsearch.discovery.zen.ZenDiscovery;
import org.elasticsearch.discovery.zen.ZenPing;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.discovery.ClusterDiscoveryConfiguration;
import org.elasticsearch.test.discovery.TestZenDiscovery;
import org.elasticsearch.test.junit.annotations.TestLogging;
import org.elasticsearch.xpack.watcher.WatcherService;
import org.elasticsearch.xpack.watcher.WatcherState;
@ -227,7 +228,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(ZenDiscovery.class).getZenPing();
ZenPing zenPing = internalCluster().getInstance(TestZenDiscovery.class).getZenPing();
if (zenPing instanceof UnicastZenPing) {
((UnicastZenPing) zenPing).clearTemporalResponses();
}