Skip to content

Commit 5245bde

Browse files
Add comment, simplify
1 parent 1014b75 commit 5245bde

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

server/src/internalClusterTest/java/org/elasticsearch/snapshots/SnapshotShutdownIT.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ public void testShutdownWhileSuccessInFlight() throws Exception {
480480
)
481481
public void testSnapshotShutdownProgressTracker() throws Exception {
482482
final var repoName = randomIdentifier();
483-
final int numShards = randomIntBetween(1, 10);
483+
final int numShards = randomIntBetween(1, 9);
484484
createRepository(repoName, "mock");
485485

486486
// Create another index on another node which will be blocked (remain in state INIT) throughout.
@@ -540,13 +540,14 @@ public void testSnapshotShutdownProgressTracker() throws Exception {
540540
mockLog.awaitAllExpectationsMatched();
541541
resetMockLog();
542542

543-
assert 1 <= numShards && numShards <= 10;
543+
// At least one shard reached the MockRepository's blocking code when waitForBlock was called. However, there's no guarantee that
544+
// the other shards got that far before the shutdown flag was put in place, in which case the other shards may be paused instead.
544545
mockLog.addExpectation(
545546
new MockLog.PatternSeenEventExpectation(
546547
"SnapshotShutdownProgressTracker running number of snapshots",
547548
SnapshotShutdownProgressTracker.class.getCanonicalName(),
548549
Level.INFO,
549-
".+Number shard snapshots running \\[" + (numShards < 10 ? "[1-" + numShards + "]" : "([1-9]|10)") + "].+"
550+
".+Number shard snapshots running \\[[1-" + numShards + "]].+"
550551
)
551552
);
552553

0 commit comments

Comments
 (0)