Skip to content

Commit

Permalink
test: increasing timeout in testServerStreamingStart (#2308)
Browse files Browse the repository at this point in the history
Fixes #1678

The assertion error tells `latch.await(2, TimeUnit.SECONDS)` did
not return true.

https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CountDownLatch.html#await-long-java.util.concurrent.TimeUnit-

> Returns:
> true if the count reached zero and false if the waiting time elapsed before the count reached zero

Under a multithreading test, there's no guarantee that
`latch.await(2, TimeUnit.SECONDS)` finishes within 2 second.
Increasing the value to 60 second to (drastically) reduce the
flakiness.
  • Loading branch information
suztomo committed Dec 15, 2023
1 parent fc140f7 commit c9cf66b
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -200,9 +200,9 @@ public void testServerStreamingStart() throws InterruptedException {

Truth.assertThat(moneyObserver.controller).isNotNull();
// wait for the task to complete, otherwise it may interfere with other tests, since they share
// the same MockService and unfinished request in this tes may start readind messages designated
// for other tests.
Truth.assertThat(latch.await(2, TimeUnit.SECONDS)).isTrue();
// the same MockService and unfinished request in this test may start reading messages
// designated for other tests.
Truth.assertThat(latch.await(60, TimeUnit.SECONDS)).isTrue();
}

@Test
Expand Down

0 comments on commit c9cf66b

Please sign in to comment.