Skip to content

Commit

Permalink
[core] Fix FileStoreCommitTest.testIndexFiles flaky ut (#3358)
Browse files Browse the repository at this point in the history
  • Loading branch information
YannByron authored May 21, 2024
1 parent b0b634f commit 7579c83
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -719,12 +719,14 @@ public void testIndexFiles() throws Exception {
indexFileHandler.scan(snapshot.id(), HASH_INDEX, part1);
assertThat(part1Index.size()).isEqualTo(2);

assertThat(part1Index.get(0).bucket()).isEqualTo(0);
assertThat(indexFileHandler.readHashIndexList(part1Index.get(0).indexFile()))
IndexManifestEntry indexManifestEntry =
part1Index.stream().filter(entry -> entry.bucket() == 0).findAny().get();
assertThat(indexFileHandler.readHashIndexList(indexManifestEntry.indexFile()))
.containsExactlyInAnyOrder(1, 2, 5);

assertThat(part1Index.get(1).bucket()).isEqualTo(1);
assertThat(indexFileHandler.readHashIndexList(part1Index.get(1).indexFile()))
indexManifestEntry =
part1Index.stream().filter(entry -> entry.bucket() == 1).findAny().get();
assertThat(indexFileHandler.readHashIndexList(indexManifestEntry.indexFile()))
.containsExactlyInAnyOrder(6, 8);

// assert part2
Expand All @@ -744,12 +746,14 @@ public void testIndexFiles() throws Exception {
part1Index = indexFileHandler.scan(snapshot.id(), HASH_INDEX, part1);
assertThat(part1Index.size()).isEqualTo(2);

assertThat(part1Index.get(0).bucket()).isEqualTo(0);
assertThat(indexFileHandler.readHashIndexList(part1Index.get(0).indexFile()))
indexManifestEntry =
part1Index.stream().filter(entry -> entry.bucket() == 0).findAny().get();
assertThat(indexFileHandler.readHashIndexList(indexManifestEntry.indexFile()))
.containsExactlyInAnyOrder(1, 4);

assertThat(part1Index.get(1).bucket()).isEqualTo(1);
assertThat(indexFileHandler.readHashIndexList(part1Index.get(1).indexFile()))
indexManifestEntry =
part1Index.stream().filter(entry -> entry.bucket() == 1).findAny().get();
assertThat(indexFileHandler.readHashIndexList(indexManifestEntry.indexFile()))
.containsExactlyInAnyOrder(6, 8);

// assert scan one bucket
Expand Down

0 comments on commit 7579c83

Please sign in to comment.