Skip to content

Commit

Permalink
fix: Fail ITHeadersTest if server does not respond to request, rather…
Browse files Browse the repository at this point in the history
… than later NPE.
  • Loading branch information
burkedavison committed Oct 3, 2022
1 parent eb9a2f1 commit 68e6e14
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,14 @@ public static void tearDown() {
}

@Test
public void testHeaders() {
public void testHeaders() throws TimeoutException, ExecutionException, InterruptedException {
OperationFuture<Operation, Operation> future =
addressesClient.insertAsync(
"testProject", "testRegion", Address.newBuilder().setName("testName").build());
try {
future.get(5, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
} catch (TimeoutException e) {
; // expected
}
future.cancel(true);

future.get(30, TimeUnit.SECONDS);

Assert.assertNotNull("Server did not process request headers.", headers);
List<String> clientIdentificationHeader = headers.get("X-goog-api-client");
Assert.assertNotNull(
"X-goog-api-client header missing. Headers found: " + String.join(", ", headers.keySet()),
Expand Down

0 comments on commit 68e6e14

Please sign in to comment.