Skip to content

Commit 1ab16fc

Browse files
authored
Fix RecoverySourceHandlerTests (#79995)
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 19ecd41 commit 1ab16fc

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
@@ -1653,7 +1653,7 @@ private boolean containsSnapshotFile(
16531653
}
16541654

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

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

0 commit comments

Comments
 (0)