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 <ankikala@amazon.com>
  • Loading branch information
ankitkala authored and Gagan Juneja committed Aug 28, 2023
1 parent b20e529 commit b4e7688
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 b4e7688

Please sign in to comment.