Skip to content

Commit 958fddc

Browse files
committed
Fix race condition in AsyncSecurityPoliciesTest.
Synchronized with the executor before asserting cancellation of the delegate future to ensure that transformAsync has finished processing the delegate future and propagated the cancellation. TAG=agy CONV=e1bfa5a2-e855-4f79-abdd-ef2b264977be
1 parent 542f840 commit 958fddc

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

binder/src/test/java/io/grpc/binder/AsyncSecurityPoliciesTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ public ListenableFuture<Status> checkAuthorizationAsync(int uid) {
289289
ListenableFuture<Status> authFuture = asyncPolicy.checkAuthorizationAsync(SOME_UID);
290290
assertThat(awaitResult(settableUid)).isEqualTo(SOME_UID);
291291
authFuture.cancel(false);
292+
executor.submit(() -> {}).get(10, TimeUnit.SECONDS);
292293

293294
assertThat(delegateAuthFuture.isCancelled()).isTrue();
294295
}

0 commit comments

Comments
 (0)