Skip to content

Commit 2cd1a30

Browse files
committed
Fix RecoverySourceHandlerTests (elastic#79546)
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
1 parent e2be62e commit 2cd1a30

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)