Skip to content

Commit 2f101c6

Browse files
committed
RepositoryAnalysisFailureIT: fix testFailsOnWriteException
With the addition of copy coverage in the repository analyzer, blob count is no longer 1:1 with blob analyzer request count: requests that create a copy count as two blobs. This can cause testFailsOnWriteException to sometimes fail, because this test randomly injects a failure somewhere between the first and blobCounth request, which may never happen if enough of the requests create copies. This simple fix is to inject the failure within blobCount/2 requests, which we will see even if every request generates a copy. An alternative could be to add a knob to the request to disallow copies and use that during this test. Closes #126747
1 parent 4ed1a00 commit 2f101c6

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,6 @@ tests:
411411
- class: org.elasticsearch.xpack.ilm.TimeSeriesDataStreamsIT
412412
method: testShrinkActionInPolicyWithoutHotPhase
413413
issue: https://github.com/elastic/elasticsearch/issues/126746
414-
- class: org.elasticsearch.repositories.blobstore.testkit.analyze.RepositoryAnalysisFailureIT
415-
method: testFailsOnWriteException
416-
issue: https://github.com/elastic/elasticsearch/issues/126747
417414

418415
# Examples:
419416
#

x-pack/plugin/snapshot-repo-test-kit/src/internalClusterTest/java/org/elasticsearch/repositories/blobstore/testkit/analyze/RepositoryAnalysisFailureIT.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ public void testFailsOnWriteException() {
234234
request.maxBlobSize(ByteSizeValue.ofBytes(10L));
235235
request.abortWritePermitted(false);
236236

237-
final CountDown countDown = new CountDown(between(1, request.getBlobCount()));
237+
// requests that create copies count as two blobs. Halving the count ensures that we trigger the disruption
238+
// even if every request is a copy
239+
final CountDown countDown = new CountDown(between(1, request.getBlobCount() / 2));
238240

239241
blobStore.setDisruption(new Disruption() {
240242

0 commit comments

Comments
 (0)