Increase timeout in PrimaryFollowerAllocationIT

A slow CI can take more than 10 seconds to relocate shards on the follower.
This commit is contained in:
Nhat Nguyen 2020-08-13 14:28:23 -04:00
parent 9cb45dafab
commit 328c86a4ec
1 changed files with 7 additions and 6 deletions

View File

@ -25,6 +25,7 @@ import org.elasticsearch.xpack.core.ccr.action.PutFollowAction;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -98,9 +99,9 @@ public class PrimaryFollowerAllocationIT extends CcrIntegTestCase {
final ShardRouting primaryShard = shardRoutingTable.primaryShard(); final ShardRouting primaryShard = shardRoutingTable.primaryShard();
assertTrue(primaryShard.assignedToNode()); assertTrue(primaryShard.assignedToNode());
final DiscoveryNode assignedNode = state.nodes().get(primaryShard.currentNodeId()); 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 // Follower primaries can be relocated to nodes without the remote cluster client role
followerClient().admin().indices().prepareUpdateSettings(followerIndex) followerClient().admin().indices().prepareUpdateSettings(followerIndex)
.setMasterNodeTimeout(TimeValue.MAX_VALUE) .setMasterNodeTimeout(TimeValue.MAX_VALUE)
@ -112,10 +113,10 @@ public class PrimaryFollowerAllocationIT extends CcrIntegTestCase {
for (ShardRouting shard : shardRoutingTable) { for (ShardRouting shard : shardRoutingTable) {
assertNotNull(shard.currentNodeId()); assertNotNull(shard.currentNodeId());
final DiscoveryNode assignedNode = state.nodes().get(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); assertIndexFullyReplicatedToFollower(leaderIndex, followerIndex);
// Follower primaries can be recovered from the existing copies on nodes without the remote cluster client role // Follower primaries can be recovered from the existing copies on nodes without the remote cluster client role
getFollowerCluster().fullRestart(); getFollowerCluster().fullRestart();
@ -126,10 +127,10 @@ public class PrimaryFollowerAllocationIT extends CcrIntegTestCase {
for (ShardRouting shard : shardRoutingTable) { for (ShardRouting shard : shardRoutingTable) {
assertNotNull(shard.currentNodeId()); assertNotNull(shard.currentNodeId());
final DiscoveryNode assignedNode = state.nodes().get(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); int moreDocs = between(0, 20);
for (int i = 0; i < moreDocs; i++) { for (int i = 0; i < moreDocs; i++) {
leaderClient().prepareIndex(leaderIndex, "_doc").setSource("f", i).get(); leaderClient().prepareIndex(leaderIndex, "_doc").setSource("f", i).get();