Skip to content

Commit 956c5cd

Browse files
authored
Fix testRestoreIncreasesPrimaryTerms on 6.x (#38314)
In 6.x the open index request does not wait for shards to be active and returns immediately. In this specific test, we want to capture the values of the primary terms before the snapshot and restore and if it does not wait for shard to be active the captured values might not be up to date. Closes #38223
1 parent 21f2c03 commit 956c5cd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

server/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3706,7 +3706,6 @@ public void testAbortedSnapshotDuringInitDoesNotStart() throws Exception {
37063706
}
37073707
}
37083708

3709-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/38223")
37103709
public void testRestoreIncreasesPrimaryTerms() {
37113710
final String indexName = randomAlphaOfLengthBetween(5, 10).toLowerCase(Locale.ROOT);
37123711
createIndex(indexName, Settings.builder()
@@ -3719,7 +3718,7 @@ public void testRestoreIncreasesPrimaryTerms() {
37193718
// open and close the index to increase the primary terms
37203719
for (int i = 0; i < randomInt(3); i++) {
37213720
assertAcked(client().admin().indices().prepareClose(indexName));
3722-
assertAcked(client().admin().indices().prepareOpen(indexName));
3721+
assertAcked(client().admin().indices().prepareOpen(indexName).setWaitForActiveShards(ActiveShardCount.ONE));
37233722
}
37243723
}
37253724

0 commit comments

Comments
 (0)