Skip to content

Commit

Permalink
Fix flaky test testStatsOnShardUnassigned in RemoteStoreStatsIT
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Singh <[email protected]>
  • Loading branch information
ashking94 committed Aug 2, 2023
1 parent 11c8426 commit 8d8df2c
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public void testStatsOnShardRelocation() {
assertEquals(destinationNode, replicaShardStat.getShardRouting().currentNodeId());
}

public void testStatsOnShardUnassigned() throws IOException {
public void testStatsOnShardUnassigned() throws Exception {
// Scenario:
// - Create index with single primary and two replica shard
// - Index documents
Expand All @@ -445,10 +445,12 @@ public void testStatsOnShardUnassigned() throws IOException {
indexDocs();
int dataNodeCountBeforeStop = client().admin().cluster().prepareHealth().get().getNumberOfDataNodes();
internalCluster().stopRandomDataNode();
assertBusy(
() -> assertEquals(dataNodeCountBeforeStop - 1, client().admin().cluster().prepareHealth().get().getNumberOfDataNodes())
);
RemoteStoreStatsResponse response = client().admin().cluster().prepareRemoteStoreStats(INDEX_NAME, "0").get();
int dataNodeCountAfterStop = client().admin().cluster().prepareHealth().get().getNumberOfDataNodes();
assertEquals(dataNodeCountBeforeStop, response.getTotalShards());
assertEquals(dataNodeCountAfterStop, response.getSuccessfulShards());
assertEquals(dataNodeCountBeforeStop - 1, response.getSuccessfulShards());
}

public void testStatsOnRemoteStoreRestore() throws IOException {
Expand Down

0 comments on commit 8d8df2c

Please sign in to comment.