diff --git a/x-pack/plugin/ccr/src/internalClusterTest/java/org/elasticsearch/xpack/ccr/PrimaryFollowerAllocationIT.java b/x-pack/plugin/ccr/src/internalClusterTest/java/org/elasticsearch/xpack/ccr/PrimaryFollowerAllocationIT.java index 7ef35ad06e8..3d9b4e23e38 100644 --- a/x-pack/plugin/ccr/src/internalClusterTest/java/org/elasticsearch/xpack/ccr/PrimaryFollowerAllocationIT.java +++ b/x-pack/plugin/ccr/src/internalClusterTest/java/org/elasticsearch/xpack/ccr/PrimaryFollowerAllocationIT.java @@ -25,6 +25,7 @@ import org.elasticsearch.xpack.core.ccr.action.PutFollowAction; import java.util.Collections; import java.util.List; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -98,9 +99,9 @@ public class PrimaryFollowerAllocationIT extends CcrIntegTestCase { final ShardRouting primaryShard = shardRoutingTable.primaryShard(); assertTrue(primaryShard.assignedToNode()); final DiscoveryNode assignedNode = state.nodes().get(primaryShard.currentNodeId()); - assertThat(assignedNode.getName(), in(dataAndRemoteNodes)); + assertThat(shardRoutingTable.toString(), assignedNode.getName(), in(dataAndRemoteNodes)); } - }); + }, 30, TimeUnit.SECONDS); // Follower primaries can be relocated to nodes without the remote cluster client role followerClient().admin().indices().prepareUpdateSettings(followerIndex) .setMasterNodeTimeout(TimeValue.MAX_VALUE) @@ -112,10 +113,10 @@ public class PrimaryFollowerAllocationIT extends CcrIntegTestCase { for (ShardRouting shard : shardRoutingTable) { assertNotNull(shard.currentNodeId()); final DiscoveryNode assignedNode = state.nodes().get(shard.currentNodeId()); - assertThat(assignedNode.getName(), in(dataOnlyNodes)); + assertThat(shardRoutingTable.toString(), assignedNode.getName(), in(dataOnlyNodes)); } } - }); + }, 30, TimeUnit.SECONDS); assertIndexFullyReplicatedToFollower(leaderIndex, followerIndex); // Follower primaries can be recovered from the existing copies on nodes without the remote cluster client role getFollowerCluster().fullRestart(); @@ -126,10 +127,10 @@ public class PrimaryFollowerAllocationIT extends CcrIntegTestCase { for (ShardRouting shard : shardRoutingTable) { assertNotNull(shard.currentNodeId()); final DiscoveryNode assignedNode = state.nodes().get(shard.currentNodeId()); - assertThat(assignedNode.getName(), in(dataOnlyNodes)); + assertThat(shardRoutingTable.toString(), assignedNode.getName(), in(dataOnlyNodes)); } } - }); + }, 30, TimeUnit.SECONDS); int moreDocs = between(0, 20); for (int i = 0; i < moreDocs; i++) { leaderClient().prepareIndex(leaderIndex, "_doc").setSource("f", i).get();