Skip to content

Commit

Permalink
Fix RecoverySourceHandlerTests (elastic#79546)
Browse files Browse the repository at this point in the history
Today RecoverySourceHandlerTests#generateFiles can generate files with
different name but same content since the lengths that we use for tests
are small. In order to avoid tripping assertions when we check that two
files are different we should check that the name is different as well
as the content are different.

Closes elastic#79502
  • Loading branch information
fcofdez committed Oct 28, 2021
1 parent e2be62e commit 2cd1a30
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1653,7 +1653,7 @@ private boolean containsSnapshotFile(
}

private boolean containsFile(List<StoreFileMetadata> filesMetadata, StoreFileMetadata storeFileMetadata) {
return filesMetadata.stream().anyMatch(f -> f.isSame(storeFileMetadata));
return filesMetadata.stream().anyMatch(f -> f.name().equals(storeFileMetadata.name()) && f.isSame(storeFileMetadata));
}

private boolean containsFile(List<StoreFileMetadata> files, String fileName, long length) {
Expand Down

0 comments on commit 2cd1a30

Please sign in to comment.