Skip to content

Commit

Permalink
Fix flaky codec tests (#9889) (#9896)
Browse files Browse the repository at this point in the history
(cherry picked from commit 731b13f)

Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 5f08608 commit 6bf9447
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private void assertReindexingWithMultipleCodecs(String destCodec, String destCod
}

private void useCodec(String index, String codec) throws ExecutionException, InterruptedException {
assertAcked(client().admin().indices().prepareClose(index));
assertAcked(client().admin().indices().prepareClose(index).setWaitForActiveShards(1));

assertAcked(
client().admin()
Expand All @@ -144,7 +144,7 @@ private void useCodec(String index, String codec) throws ExecutionException, Int
.get()
);

assertAcked(client().admin().indices().prepareOpen(index));
assertAcked(client().admin().indices().prepareOpen(index).setWaitForActiveShards(1));
}

private void flushAndRefreshIndex(String index) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void testZStandardToLuceneCodecsWithCompressionLevel() throws ExecutionEx
);
ensureGreen(index);

assertAcked(client().admin().indices().prepareClose(index));
assertAcked(client().admin().indices().prepareClose(index).setWaitForActiveShards(1));

Throwable executionException = expectThrows(
ExecutionException.class,
Expand Down Expand Up @@ -128,7 +128,7 @@ public void testZStandardToLuceneCodecsWithCompressionLevel() throws ExecutionEx
.get()
);

assertAcked(client().admin().indices().prepareOpen(index));
assertAcked(client().admin().indices().prepareOpen(index).setWaitForActiveShards(1));
ensureGreen(index);
}

Expand All @@ -148,7 +148,7 @@ public void testLuceneToZStandardCodecsWithCompressionLevel() throws ExecutionEx
);
ensureGreen(index);

assertAcked(client().admin().indices().prepareClose(index));
assertAcked(client().admin().indices().prepareClose(index).setWaitForActiveShards(1));

Throwable executionException = expectThrows(
ExecutionException.class,
Expand Down Expand Up @@ -181,7 +181,7 @@ public void testLuceneToZStandardCodecsWithCompressionLevel() throws ExecutionEx
.get()
);

assertAcked(client().admin().indices().prepareOpen(index));
assertAcked(client().admin().indices().prepareOpen(index).setWaitForActiveShards(1));
ensureGreen(index);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singletonList(CustomCodecPlugin.class);
}

@AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/9872")
public void testForceMergeMultipleCodecs() throws ExecutionException, InterruptedException {

Map<String, String> codecMap = Map.of(
Expand Down Expand Up @@ -119,7 +118,7 @@ private void forceMergeMultipleCodecs(String finalCodec, String finalCodecMode,
}

private void useCodec(String index, String codec) throws ExecutionException, InterruptedException {
assertAcked(client().admin().indices().prepareClose(index));
assertAcked(client().admin().indices().prepareClose(index).setWaitForActiveShards(1));

assertAcked(
client().admin()
Expand All @@ -128,7 +127,7 @@ private void useCodec(String index, String codec) throws ExecutionException, Int
.get()
);

assertAcked(client().admin().indices().prepareOpen(index));
assertAcked(client().admin().indices().prepareOpen(index).setWaitForActiveShards(1));
}

private void ingestDocs(String index) throws InterruptedException {
Expand Down

0 comments on commit 6bf9447

Please sign in to comment.