[BUG] ConcurrentSnapshotsIT#testAssertMultipleSnapshotsAndPrimaryFailOver fails intermittently (#1311)

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
This commit is contained in:
Andriy Redko 2021-09-30 12:44:29 -04:00 committed by GitHub
parent 180db5cd09
commit d46c206f29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 1 deletions

View File

@ -530,7 +530,10 @@ public class ConcurrentSnapshotsIT extends AbstractSnapshotIntegTestCase {
final String secondSnapshot = "snapshot-two"; final String secondSnapshot = "snapshot-two";
final ActionFuture<CreateSnapshotResponse> secondSnapshotResponse = startFullSnapshotFromMasterClient(repoName, secondSnapshot); final ActionFuture<CreateSnapshotResponse> secondSnapshotResponse = startFullSnapshotFromMasterClient(repoName, secondSnapshot);
// make sure second snapshot is in progress before restarting data node
waitUntilInprogress(repoName, secondSnapshot, TimeValue.timeValueSeconds(5L));
internalCluster().restartNode(dataNode, InternalTestCluster.EMPTY_CALLBACK); internalCluster().restartNode(dataNode, InternalTestCluster.EMPTY_CALLBACK);
assertThat(firstSnapshotResponse.get().getSnapshotInfo().state(), is(SnapshotState.PARTIAL)); assertThat(firstSnapshotResponse.get().getSnapshotInfo().state(), is(SnapshotState.PARTIAL));
@ -1382,4 +1385,17 @@ public class ConcurrentSnapshotsIT extends AbstractSnapshotIntegTestCase {
waitForBlock(internalCluster().getMasterName(), blockedRepoName, TimeValue.timeValueSeconds(30L)); waitForBlock(internalCluster().getMasterName(), blockedRepoName, TimeValue.timeValueSeconds(30L));
return fut; return fut;
} }
private static void waitUntilInprogress(final String repoName, final String snapshotName,
TimeValue timeout) throws InterruptedException {
waitUntil(() ->
currentSnapshots(repoName)
.stream()
.filter(s -> s.snapshotId().getName().equals(snapshotName))
.filter(s -> s.state() == SnapshotState.IN_PROGRESS)
.findAny()
.isPresent(),
timeout.millis(),
TimeUnit.MILLISECONDS);
}
} }