Skip to content

Commit 26254e3

Browse files
authored
RepositoryAnalysisFailureIT: disrupt earlier (#127032)
The fix to #126747 was only for one test. This applies that change to all the tests in this suite that need it. Fixes #127029
1 parent 3156cc7 commit 26254e3

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
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.packaging.test.DockerTests
412412
method: test024InstallPluginFromArchiveUsingConfigFile
413413
issue: https://github.com/elastic/elasticsearch/issues/126936
414-
- class: org.elasticsearch.repositories.blobstore.testkit.analyze.RepositoryAnalysisFailureIT
415-
method: testFailsOnReadError
416-
issue: https://github.com/elastic/elasticsearch/issues/127029
417414
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
418415
method: test {p0=esql/10_basic/basic with documents_found}
419416
issue: https://github.com/elastic/elasticsearch/issues/127039

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public void testFailsOnReadError() {
134134
request.maxBlobSize(ByteSizeValue.ofBytes(10L));
135135
request.abortWritePermitted(false);
136136

137-
final CountDown countDown = new CountDown(between(1, request.getBlobCount()));
137+
final CountDown countDown = createDisruptionCountdown(request);
138138
blobStore.setDisruption(new Disruption() {
139139
@Override
140140
public byte[] onRead(byte[] actualContents, long position, long length) throws IOException {
@@ -158,7 +158,7 @@ public void testFailsOnNotFoundAfterWrite() {
158158
request.abortWritePermitted(false);
159159
request.rareActionProbability(0.0); // not found on an early read or an overwrite is ok
160160

161-
final CountDown countDown = new CountDown(between(1, request.getBlobCount()));
161+
final CountDown countDown = createDisruptionCountdown(request);
162162

163163
blobStore.setDisruption(new Disruption() {
164164
@Override
@@ -212,7 +212,7 @@ public void testFailsOnChecksumMismatch() {
212212
// leads to CI failures. Therefore, we disable rare actions to improve CI stability.
213213
request.rareActionProbability(0.0);
214214

215-
final CountDown countDown = new CountDown(between(1, request.getBlobCount()));
215+
final CountDown countDown = createDisruptionCountdown(request);
216216

217217
blobStore.setDisruption(new Disruption() {
218218
@Override
@@ -234,9 +234,7 @@ public void testFailsOnWriteException() {
234234
request.maxBlobSize(ByteSizeValue.ofBytes(10L));
235235
request.abortWritePermitted(false);
236236

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));
237+
final CountDown countDown = createDisruptionCountdown(request);
240238

241239
blobStore.setDisruption(new Disruption() {
242240

@@ -526,6 +524,12 @@ private static void assertPurpose(OperationPurpose purpose) {
526524
assertEquals(OperationPurpose.REPOSITORY_ANALYSIS, purpose);
527525
}
528526

527+
private static CountDown createDisruptionCountdown(RepositoryAnalyzeAction.Request request) {
528+
// requests that create copies count as two blobs. Halving the count ensures that we trigger the disruption
529+
// even if every request is a copy
530+
return new CountDown(between(1, request.getBlobCount() / 2));
531+
}
532+
529533
public static class TestPlugin extends Plugin implements RepositoryPlugin {
530534

531535
static final String DISRUPTABLE_REPO_TYPE = "disruptable";

0 commit comments

Comments
 (0)