Skip to content

Commit feb6367

Browse files
committed
FsBlobContainerTests: small improvements to testCopy
1 parent e2c3d74 commit feb6367

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

server/src/test/java/org/elasticsearch/common/blobstore/fs/FsBlobContainerTests.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -385,17 +385,18 @@ public void testCopy() throws IOException {
385385
final var targetPath = BlobPath.EMPTY.add("target");
386386
final var targetContainer = store.blobContainer(targetPath);
387387

388-
final String blobName = randomAlphaOfLengthBetween(1, 20).toLowerCase(Locale.ROOT);
388+
final var sourceBlobName = randomAlphaOfLengthBetween(1, 20).toLowerCase(Locale.ROOT);
389+
final var targetBlobName = randomAlphaOfLengthBetween(1, 20).toLowerCase(Locale.ROOT);
389390
final var contents = new BytesArray(randomByteArrayOfLength(randomIntBetween(1, 512)));
390-
sourceContainer.writeBlobAtomic(randomPurpose(), blobName, contents, true);
391-
sourceContainer.copyBlob(randomPurpose(), blobName, targetContainer, blobName, true);
391+
sourceContainer.writeBlobAtomic(randomPurpose(), sourceBlobName, contents, true);
392+
sourceContainer.copyBlob(randomPurpose(), sourceBlobName, targetContainer, targetBlobName, true);
392393
assertThrows(
393394
FileAlreadyExistsException.class,
394-
() -> sourceContainer.copyBlob(randomPurpose(), blobName, targetContainer, blobName, true)
395+
() -> sourceContainer.copyBlob(randomPurpose(), sourceBlobName, targetContainer, targetBlobName, true)
395396
);
396397

397-
var targetContents = new BytesArray(targetContainer.readBlob(randomPurpose(), blobName).readAllBytes());
398-
assertArrayEquals(contents.array(), targetContents.array());
398+
var targetContents = new BytesArray(targetContainer.readBlob(randomPurpose(), targetBlobName).readAllBytes());
399+
assertEquals(contents, targetContents);
399400
}
400401

401402
static class MockFileSystemProvider extends FilterFileSystemProvider {

0 commit comments

Comments
 (0)