Skip to content

Commit 18a9ded

Browse files
Fix Repository Cleanup Test Correctness (elastic#44738)
* The tests were creating the corruption and asserting its existence not on the repository base path but on a clean path. As a result the consistency assertion on the repository wouldn't see the corruption ever an pass even if the cleanup was broken for repositories that have a non-root base path
1 parent e22ce5a commit 18a9ded

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/framework/src/main/java/org/elasticsearch/repositories/AbstractThirdPartyRepositoryTestCase.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,10 @@ public void testCleanup() throws Exception {
236236
@Override
237237
protected void doRun() throws Exception {
238238
final BlobStore blobStore = repo.blobStore();
239-
blobStore.blobContainer(BlobPath.cleanPath().add("indices").add("foo"))
239+
blobStore.blobContainer(repo.basePath().add("indices").add("foo"))
240240
.writeBlob("bar", new ByteArrayInputStream(new byte[0]), 0, false);
241241
for (String prefix : Arrays.asList("snap-", "meta-")) {
242-
blobStore.blobContainer(BlobPath.cleanPath())
242+
blobStore.blobContainer(repo.basePath())
243243
.writeBlob(prefix + "foo.dat", new ByteArrayInputStream(new byte[0]), 0, false);
244244
}
245245
future.onResponse(null);
@@ -260,10 +260,10 @@ protected boolean assertCorruptionVisible(BlobStoreRepository repo, Executor exe
260260
protected void doRun() throws Exception {
261261
final BlobStore blobStore = repo.blobStore();
262262
future.onResponse(
263-
blobStore.blobContainer(BlobPath.cleanPath().add("indices")).children().containsKey("foo")
264-
&& BlobStoreTestUtil.blobExists(blobStore.blobContainer(BlobPath.cleanPath().add("indices").add("foo")), "bar")
265-
&& BlobStoreTestUtil.blobExists(blobStore.blobContainer(BlobPath.cleanPath()), "meta-foo.dat")
266-
&& BlobStoreTestUtil.blobExists(blobStore.blobContainer(BlobPath.cleanPath()), "snap-foo.dat")
263+
blobStore.blobContainer(repo.basePath().add("indices")).children().containsKey("foo")
264+
&& BlobStoreTestUtil.blobExists(blobStore.blobContainer(repo.basePath().add("indices").add("foo")), "bar")
265+
&& BlobStoreTestUtil.blobExists(blobStore.blobContainer(repo.basePath()), "meta-foo.dat")
266+
&& BlobStoreTestUtil.blobExists(blobStore.blobContainer(repo.basePath()), "snap-foo.dat")
267267
);
268268
}
269269
});

0 commit comments

Comments
 (0)