Skip to content

Commit 68e6e14

Browse files
committed
fix: Fail ITHeadersTest if server does not respond to request, rather than later NPE.
1 parent eb9a2f1 commit 68e6e14

File tree

1 file changed

+4
-9
lines changed
  • java-compute/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/integration

1 file changed

+4
-9
lines changed

java-compute/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/integration/ITHeadersTest.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,14 @@ public static void tearDown() {
7373
}
7474

7575
@Test
76-
public void testHeaders() {
76+
public void testHeaders() throws TimeoutException, ExecutionException, InterruptedException {
7777
OperationFuture<Operation, Operation> future =
7878
addressesClient.insertAsync(
7979
"testProject", "testRegion", Address.newBuilder().setName("testName").build());
80-
try {
81-
future.get(5, TimeUnit.SECONDS);
82-
} catch (InterruptedException | ExecutionException e) {
83-
e.printStackTrace();
84-
} catch (TimeoutException e) {
85-
; // expected
86-
}
87-
future.cancel(true);
8880

81+
future.get(30, TimeUnit.SECONDS);
82+
83+
Assert.assertNotNull("Server did not process request headers.", headers);
8984
List<String> clientIdentificationHeader = headers.get("X-goog-api-client");
9085
Assert.assertNotNull(
9186
"X-goog-api-client header missing. Headers found: " + String.join(", ", headers.keySet()),

0 commit comments

Comments
 (0)