Skip to content

Commit ed70e2c

Browse files
committed
TEST: Wait for active shards after re-open follower
In testValidateFollowingIndexSettings, we close/open the follower index, then make that index follow the leader. The default value of `wait_for_active_shards` in 6.x is NONE, thus the open command may return before the primary shard gets allocated. This commit makes sure that we wait for the primary allocated after re-opening an index before following another index.
1 parent a9517e7 commit ed70e2c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/ShardChangesIT.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.elasticsearch.action.index.IndexRequest;
1818
import org.elasticsearch.action.search.SearchRequest;
1919
import org.elasticsearch.action.search.SearchResponse;
20+
import org.elasticsearch.action.support.ActiveShardCount;
2021
import org.elasticsearch.analysis.common.CommonAnalysisPlugin;
2122
import org.elasticsearch.cluster.ClusterState;
2223
import org.elasticsearch.cluster.metadata.MappingMetaData;
@@ -36,7 +37,6 @@
3637
import org.elasticsearch.tasks.TaskInfo;
3738
import org.elasticsearch.test.ESIntegTestCase;
3839
import org.elasticsearch.test.discovery.TestZenDiscovery;
39-
import org.elasticsearch.test.junit.annotations.TestLogging;
4040
import org.elasticsearch.xpack.ccr.action.CreateAndFollowIndexAction;
4141
import org.elasticsearch.xpack.ccr.action.FollowIndexAction;
4242
import org.elasticsearch.xpack.ccr.action.ShardChangesAction;
@@ -431,7 +431,6 @@ public void testFollowNonExistentIndex() throws Exception {
431431
expectThrows(IllegalArgumentException.class, () -> client().execute(FollowIndexAction.INSTANCE, followRequest3).actionGet());
432432
}
433433

434-
@TestLogging("_root:DEBUG")
435434
public void testValidateFollowingIndexSettings() throws Exception {
436435
assertAcked(client().admin().indices().prepareCreate("test-leader")
437436
.setSettings(Settings.builder().put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)));
@@ -452,7 +451,7 @@ public void testValidateFollowingIndexSettings() throws Exception {
452451
assertAcked(client().admin().indices().prepareClose("test-follower"));
453452
assertAcked(client().admin().indices().prepareUpdateSettings("test-follower")
454453
.setSettings(Settings.builder().put(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey(), true)));
455-
assertAcked(client().admin().indices().prepareOpen("test-follower"));
454+
assertAcked(client().admin().indices().prepareOpen("test-follower").setWaitForActiveShards(ActiveShardCount.DEFAULT));
456455
assertAcked(client().execute(FollowIndexAction.INSTANCE,
457456
createFollowRequest("test-leader", "test-follower")).actionGet());
458457
unfollowIndex("test-follower");

0 commit comments

Comments
 (0)