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 1 commit
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 recommended way to interact with Argument
// captors - otherwise it may incur in unexpected behaviour
Mockito.verify(callContext, Mockito.timeout(0)).withOption(key.capture(), value.capture());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the Mockito.timeout(0) if the time out value is 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not necessary. I removed it in a new commit


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