Skip to content

Commit

Permalink
Fix flaky test ArchivedIndexSettingsIT (opensearch-project#9515)
Browse files Browse the repository at this point in the history
* Fix flaky test ArchivedIndexSettingsIT

Signed-off-by: Ankit Kala <[email protected]>
Signed-off-by: Ivan Brusic <[email protected]>
  • Loading branch information
ankitkala authored and brusic committed Sep 25, 2023
1 parent ada9543 commit abcffe8
Showing 1 changed file with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;

import static org.opensearch.gateway.GatewayService.STATE_NOT_RECOVERED_BLOCK;
import static org.hamcrest.Matchers.startsWith;

@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0, supportsDedicatedMasters = false)
Expand Down Expand Up @@ -48,12 +50,28 @@ public void testArchiveSettings() throws Exception {
internalCluster().restartNode(newClusterManagerNode);

// Verify that archived settings exists.
assertTrue(
client().admin().indices().prepareGetSettings("test").get().getIndexToSettings().get("test").hasValue("archived.index.dummy")
);
assertTrue(
client().admin().indices().prepareGetSettings("test").get().getIndexToSettings().get("test").hasValue("archived.index.dummy2")
);
assertBusy(() -> {
// Verify that cluster state is in recovered state.
assertFalse(client().admin().cluster().prepareState().get().getState().blocks().hasGlobalBlock(STATE_NOT_RECOVERED_BLOCK));
assertTrue(
client().admin()
.indices()
.prepareGetSettings("test")
.get()
.getIndexToSettings()
.get("test")
.hasValue("archived.index.dummy")
);
assertTrue(
client().admin()
.indices()
.prepareGetSettings("test")
.get()
.getIndexToSettings()
.get("test")
.hasValue("archived.index.dummy2")
);
}, 30, TimeUnit.SECONDS);

// Archived setting update should fail on open index.
IllegalArgumentException exception = expectThrows(
Expand Down

0 comments on commit abcffe8

Please sign in to comment.