[dds/dap] Fix flaky tests waiting for breakpoint resolved events on slow bots

This test shows up as flaky quite often. It's waiting for breakpoint Resolved events by just calling `await pumpEventQueue(times: 5000);` but it appears this sometimes doesn't get all of the events.

This change waits up to 5s for the events to arrive (because we unfortunately have no signal to know when they should have come through). I'm hopeful 5s is more than enough and this won't flake, but we could increase this as not - the goal of this test is not to verify performance but just ensure the events do arrive.

Change-Id: Ia2236b65bbb5d11e2a5519d49869c6b87202a940
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367301
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
This commit is contained in:
Danny Tuppeny 2024-05-22 14:13:56 +00:00 committed by Commit Queue
parent fb057ea4e0
commit e43bbe32fa

View file

@ -100,7 +100,13 @@ main() {
}
}
await pumpEventQueue(times: 5000);
// Wait up to a few seconds for the resolved events to come through to
// allow for slow CI bots, but exit early if they all arrived.
final testUntil = DateTime.now().toUtc().add(const Duration(seconds: 5));
while (DateTime.now().toUtc().isBefore(testUntil) &&
resolvedBreakpoints.length < addedBreakpoints.length) {
await pumpEventQueue(times: 5000);
}
await breakpointResolveSubscription.cancel();
// Ensure every breakpoint that was added was also resolved.