Skip to content

Commit 4b27ad8

Browse files
authored
Fix RecoverySourceHandlerTests (#79996)
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 #79502 Backport of #79546
1 parent 90fec3b commit 4b27ad8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/src/test/java/org/elasticsearch/indices/recovery/RecoverySourceHandlerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,7 @@ private boolean containsSnapshotFile(
16501650
}
16511651

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

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

0 commit comments

Comments
 (0)