Skip to content

Commit

Permalink
Fix flaky pit/scroll tests in SegmentReplicationIT (#10770)
Browse files Browse the repository at this point in the history
This change adds an assertBusy to wait until files are cleared from disk as it is not
synchronous with the scroll/pit removal.

Signed-off-by: Marc Handalian <handalm@amazon.com>
(cherry picked from commit c1962cc)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Nov 6, 2023
1 parent 7bf2a3a commit 76f3ed9
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1066,9 +1066,14 @@ public void testScrollCreatedOnReplica() throws Exception {

client(replica).prepareClearScroll().addScrollId(searchResponse.getScrollId()).get();

currentFiles = List.of(replicaShard.store().directory().listAll());
assertFalse("Files should be cleaned up post scroll clear request", currentFiles.containsAll(snapshottedSegments));
assertBusy(
() -> assertFalse(
"Files should be cleaned up post scroll clear request",
List.of(replicaShard.store().directory().listAll()).containsAll(snapshottedSegments)
)
);
assertEquals(100, scrollHits);

}

/**
Expand Down Expand Up @@ -1327,9 +1332,12 @@ public void testPitCreatedOnReplica() throws Exception {
// delete the PIT
DeletePitRequest deletePITRequest = new DeletePitRequest(pitResponse.getId());
client().execute(DeletePitAction.INSTANCE, deletePITRequest).actionGet();

currentFiles = List.of(replicaShard.store().directory().listAll());
assertFalse("Files should be cleaned up", currentFiles.containsAll(snapshottedSegments));
assertBusy(
() -> assertFalse(
"Files should be cleaned up",
List.of(replicaShard.store().directory().listAll()).containsAll(snapshottedSegments)
)
);
}

/**
Expand Down

0 comments on commit 76f3ed9

Please sign in to comment.