Skip to content

Commit d9db70d

Browse files
committed
Fix failure-path test
1 parent ca737a8 commit d9db70d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,24 @@ public void testFailsOnCopyAfterWrite() {
178178
request.maxBlobSize(ByteSizeValue.ofBytes(10L));
179179
request.abortWritePermitted(false);
180180

181+
final AtomicBoolean failedCopy = new AtomicBoolean();
181182
blobStore.setDisruption(new Disruption() {
182183
@Override
183184
public void onCopy() throws IOException {
185+
failedCopy.set(true);
184186
throw new IOException("simulated");
185187
}
186188
});
187189

188-
assertAnalysisFailureMessage(analyseRepositoryExpectFailure(request).getMessage());
190+
safeAwait((ActionListener<RepositoryAnalyzeAction.Response> l) -> analyseRepository(request, l.delegateResponse((ll, e) -> {
191+
if (ExceptionsHelper.unwrapCause(e) instanceof RepositoryVerificationException repositoryVerificationException) {
192+
assertAnalysisFailureMessage(repositoryVerificationException.getMessage());
193+
assertTrue("did not fail a copy operation, so why did the verification fail?", failedCopy.get());
194+
ll.onResponse(null);
195+
} else {
196+
ll.onFailure(e);
197+
}
198+
})));
189199
}
190200

191201
public void testFailsOnChecksumMismatch() {

0 commit comments

Comments
 (0)