Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

fix(test): testThrottlingBlocking flakyness fix #1775

Merged
merged 2 commits into from Aug 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -887,10 +887,15 @@ public void run() {
}

try {
future.get(100, TimeUnit.MILLISECONDS);
future.get(3, TimeUnit.SECONDS);
} catch (TimeoutException e) {
assertWithMessage("adding elements to batcher should not be blocked").fail();
}

// Mockito recommends using verify() as the ONLY way to interact with Argument
// captors - otherwise it may incur in unexpected behaviour
Mockito.verify(callContext).withOption(key.capture(), value.capture());

// Verify that throttled time is recorded in ApiCallContext
assertThat(key.getValue()).isSameInstanceAs(Batcher.THROTTLED_TIME_KEY);
assertThat(value.getValue()).isAtLeast(throttledTime);
Expand Down