You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/10/26 07:26:19 UTC
[GitHub] [bookkeeper] hangc0276 opened a new pull request, #3581: Replace sleep with await to avoid flaky test in SlowBookieTest
hangc0276 opened a new pull request, #3581:
URL: https://github.com/apache/bookkeeper/pull/3581
### Motivation
There is a lot of `Thread.sleep()` in Bookie tests, which may lead to flaky tests.
### Changes
Replace sleep with await to avoid flaky test in SlowBookieTest
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] zymap merged pull request #3581: Replace sleep with await to avoid flaky test in SlowBookieTest
Posted by GitBox <gi...@apache.org>.
zymap merged PR #3581:
URL: https://github.com/apache/bookkeeper/pull/3581
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] zymap commented on a diff in pull request #3581: Replace sleep with await to avoid flaky test in SlowBookieTest
Posted by GitBox <gi...@apache.org>.
zymap commented on code in PR #3581:
URL: https://github.com/apache/bookkeeper/pull/3581#discussion_r1006322278
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/client/SlowBookieTest.java:
##########
@@ -419,11 +419,9 @@ public void testWaitForWritable() throws Exception {
final long timeout = 10000;
// waitForWritable async
- new Thread(() -> {
- isWriteable.set(lh.waitForWritable(writeSet, 0, timeout));
- }).start();
- TimeUnit.MILLISECONDS.sleep(5000);
- assertFalse(isWriteable.get());
+ new Thread(() -> isWriteable.set(lh.waitForWritable(writeSet, 0, timeout))).start();
+
+ Awaitility.await().untilAsserted(() -> assertFalse(isWriteable.get()));
Review Comment:
```suggestion
Awaitility.await().pollDelay(5, TimeUnit.SECONDS).untilAsserted(() -> assertFalse(isWriteable.get()));
```
Because the isWritable is false from the beginning, we want to wait a moment to verify it still in `waitForWritable` backoff
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org