Skip to content

Commit

Permalink
fix flaky codec tests
Browse files Browse the repository at this point in the history
Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
  • Loading branch information
sarthakaggarwal97 committed Sep 7, 2023
1 parent d58943d commit 27fbb3f
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 27fbb3f

Please sign in to comment.