Unpredictable behavior around `during` and `atMost`

29 views
Skip to first unread message

Sergey Petrovsky

unread,
Jul 9, 2020, 12:04:13 PM7/9/20
to Awaitility
While I was testing Kafka I end up with some issues around Awaitility. The goal was to test that Kafka topic doesn't contain the new records for a specified time. This is the simplified scratch of my test but it shows the problem. I expect that ConditionTimeoutException doesn't throw in this case. But it does.

public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        await("wait").during(5_000, TimeUnit.MILLISECONDS).atMost(5_000, TimeUnit.MILLISECONDS)
                .pollInterval(100, TimeUnit.MILLISECONDS)
                .until(() -> list, List::isEmpty);
}

I increased the `atMost` timeout to 5000 + pollInterval -> 5100 but still end up with exception. On my local machine throwing exception was stoped closed the value of `atMost` timeout of 5170-5180.
Should I keep something in mind? Or may the test isn't correct?

Johan Haleby

unread,
Jul 13, 2020, 7:50:32 AM7/13/20
to await...@googlegroups.com
I think something is fishy with the implementation. It was a PR but it probably should've been tested a bit more. It's on my to do list to go over it and hopefully fix it. "Just" need to find the time :)

--
You received this message because you are subscribed to the Google Groups "Awaitility" group.
To unsubscribe from this group and stop receiving emails from it, send an email to awaitility+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/awaitility/08d55661-bc06-42b1-b5f1-57d13be111fbo%40googlegroups.com.

Sergey Petrovsky

unread,
Jul 13, 2020, 11:52:03 AM7/13/20
to Awaitility
Johan Haleby, thanks a lot for the clarification:)
Reply all
Reply to author
Forward
0 new messages