Skip to content

Commit c9cf66b

Browse files
authored
test: increasing timeout in testServerStreamingStart (#2308)
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.
1 parent fc140f7 commit c9cf66b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/HttpJsonDirectServerStreamingCallableTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ public void testServerStreamingStart() throws InterruptedException {
200200

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

208208
@Test

0 commit comments

Comments
 (0)