-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix assertion in SnapshotShutdownIT.testSnapshotShutdownProgressTracker()
#127998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Relaxes a log expectation assertion from an exact test of numShards running snapshots to 1-numShards, since it is possible for some of the shard snapshot statuses to already be in stage=PAUSED. Closes elastic#127690
|
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
| mockLog.awaitAllExpectationsMatched(); | ||
| resetMockLog(); | ||
|
|
||
| assert 1 <= numShards && numShards <= 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| assert 1 <= numShards && numShards <= 10; | |
| // At least one shard reached the MockRepository's blocking code when waitForBlock was called. However, there's no guarantee that | |
| // the other shards got that far before the shutdown flag was put in place, in which case the other shards may be paused instead. | |
| assert 1 <= numShards && numShards <= 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering why we are asserting this because final int numShards = randomIntBetween(1, 10); already says it's going to be between 1 and 10?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the code comment. In the chance the thread bounds were changed it seemed clearer to enforce the restriction there instead of waiting for the seen event timeout. I can see it doesn't add value, the assertion is removed now.
| SnapshotShutdownProgressTracker.class.getCanonicalName(), | ||
| Level.INFO, | ||
| "*Number shard snapshots running [" + numShards + "].*" | ||
| ".+Number shard snapshots running \\[" + (numShards < 10 ? "[1-" + numShards + "]" : "([1-9]|10)") + "].+" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change the final int numShards = randomIntBetween(1, 10); to final int numShards = randomIntBetween(1, 9); to make this easier? The random number range is arbitrary, so I think that would be okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ (or else maybe leave this as a SeenEventExpectation and parse out the numShards by overriding innerMatch rather than trying to do anything overly clever with a regex)
DaveCTurner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…er() (elastic#127998) Relaxes a log expectation assertion from an exact test of numShards running snapshots to 1-numShards, since it is possible for some of the shard snapshot statuses to already be in stage=PAUSED. Closes elastic#127690
…er() (elastic#127998) Relaxes a log expectation assertion from an exact test of numShards running snapshots to 1-numShards, since it is possible for some of the shard snapshot statuses to already be in stage=PAUSED. Closes elastic#127690
Relaxes a log expectation assertion from an exact test of
numShardsrunning snapshots to1-numShards, since itis possible for some of the shard snapshot statuses to already be in
stage=PAUSED.Closes #127690