Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set a longer timeout to wait for callbacks to be executed #1478

Merged
merged 2 commits into from
Oct 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,12 @@ public void testRetryCount() {
stub.mutateRowCallable()
.call(RowMutation.create(TABLE_ID, "random-row").setCell("cf", "q", "value"));

// onOperationComplete() is called in TracerFinisher which will be called after the mutateRow
// call is returned. So there's a race between when the call returns and when the putRetryCount
// is called in onOperationCompletion().
verify(statsRecorderWrapper, timeout(20)).putRetryCount(retryCount.capture());
// In TracedUnaryCallable, we create a future and add a TraceFinisher to the callback. Main
// thread is blocked on waiting for the future to be completed. When onComplete is called on
// the grpc thread, the future is completed, however we might not have enough time for
// TraceFinisher to run. Add a 1 second time out to wait for the callback. This shouldn't have
// any impact on production code.
verify(statsRecorderWrapper, timeout(1000)).putRetryCount(retryCount.capture());

assertThat(retryCount.getValue()).isEqualTo(fakeService.getAttemptCounter().get() - 1);
}
Expand Down