-
Notifications
You must be signed in to change notification settings - Fork 151
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
[MINOR] fix(test): Fix flaky test for CoordinatorReconfigureNodeMaxTest#testReconfigureNodeMax #2325
base: master
Are you sure you want to change the base?
[MINOR] fix(test): Fix flaky test for CoordinatorReconfigureNodeMaxTest#testReconfigureNodeMax #2325
Conversation
@@ -131,9 +131,11 @@ public void testReconfigureNodeMax() throws Exception { | |||
assertEquals(5, info.getServerToPartitionRanges().keySet().size()); | |||
|
|||
// case3: recover its value to 10 | |||
Thread.sleep(1000L); |
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.
We should Awaitility.await
.
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.
@jerqi I added a new comment above this line. This sleep to make sure the last modification time of the tempConfFilePath
file changed.
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.
You wait for a modification timestamp instead sleep
.
File tempConfFile = new File(tempConfFilePath); | ||
long currentTime = System.currentTimeMillis(); | ||
if (currentTime - tempConfFile.lastModified() < 1000) { | ||
Thread.sleep(1000 - (currentTime - tempConfFile.lastModified())); |
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.
Could use Awaitility.await()
instead of sleep
?
What changes were proposed in this pull request?
Fix flaky test for CoordinatorReconfigureNodeMaxTest#testReconfigureNodeMax
Why are the changes needed?
Make CI stable.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Existing UTs.