From 1112a2e8b7d88641d26678b974f595c327a3506d Mon Sep 17 00:00:00 2001 From: Yannick Welsch Date: Tue, 8 Nov 2016 15:15:48 +0100 Subject: [PATCH] Fix for ClusterStateObserver changes in core Companion commit for elastic/elasticsearchelastic/elasticsearch#21379 Original commit: elastic/x-pack-elasticsearch@b0011dcc9d41301d2d5aad180acfafb085544a9f --- .../org/elasticsearch/xpack/security/SecurityTribeIT.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/security/SecurityTribeIT.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/security/SecurityTribeIT.java index b30131c5321..591b592a3da 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/security/SecurityTribeIT.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/security/SecurityTribeIT.java @@ -11,6 +11,7 @@ import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateObserver; import org.elasticsearch.cluster.service.ClusterService; +import org.elasticsearch.cluster.service.ClusterServiceState; import org.elasticsearch.common.UUIDs; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; @@ -172,7 +173,7 @@ public class SecurityTribeIT extends NativeRealmIntegTestCase { final int cluster2Nodes = cluster2.size(); logger.info("waiting for [{}] nodes to be added to the tribe cluster state", cluster1Nodes + cluster2Nodes + 2); final Predicate nodeCountPredicate = state -> state.nodes().getSize() == cluster1Nodes + cluster2Nodes + 3; - if (nodeCountPredicate.test(observer.observedState()) == false) { + if (nodeCountPredicate.test(observer.observedState().getClusterState()) == false) { CountDownLatch latch = new CountDownLatch(1); observer.waitForNextChange(new ClusterStateObserver.Listener() { @Override @@ -193,8 +194,8 @@ public class SecurityTribeIT extends NativeRealmIntegTestCase { } }, new ClusterStateObserver.ValidationPredicate() { @Override - protected boolean validate(ClusterState newState) { - return nodeCountPredicate.test(newState); + protected boolean validate(ClusterServiceState newState) { + return nodeCountPredicate.test(newState.getClusterState()); } }); latch.await();