From 42676a6b2e73306458643603381c46743801a544 Mon Sep 17 00:00:00 2001 From: tallison Date: Mon, 2 Dec 2019 16:18:12 -0500 Subject: [PATCH] improve logging and error reporting in TikaServerIntegrationTest --- .../tika/server/TikaServerIntegrationTest.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tika-server/src/test/java/org/apache/tika/server/TikaServerIntegrationTest.java b/tika-server/src/test/java/org/apache/tika/server/TikaServerIntegrationTest.java index e98ce8cf28..a91962b382 100644 --- a/tika-server/src/test/java/org/apache/tika/server/TikaServerIntegrationTest.java +++ b/tika-server/src/test/java/org/apache/tika/server/TikaServerIntegrationTest.java @@ -423,27 +423,32 @@ public void run() { } private void awaitServerStartup() throws Exception { - + long maxWaitMs = 30000; Instant started = Instant.now(); long elapsed = Duration.between(started, Instant.now()).toMillis(); WebClient client = WebClient.create(endPoint+"/tika").accept("text/plain"); - while (elapsed < 30000) { + while (elapsed < maxWaitMs) { try { Response response = client.get(); if (response.getStatus() == 200) { - return; + Thread.sleep(100); + response = client.get(); + if (response.getStatus() == 200) { + LOG.info("client observes that server successfully started"); + return; + } } - LOG.info("tika test client failed to connect to server with status: {}", response.getStatus()); + LOG.debug("tika test client failed to connect to server with status: {}", response.getStatus()); } catch (javax.ws.rs.ProcessingException e) { - LOG.info("tika test client failed to connect to server: {}", e.getMessage()); LOG.debug("tika test client failed to connect to server", e); } Thread.sleep(100); elapsed = Duration.between(started, Instant.now()).toMillis(); } - + throw new IllegalStateException("couldn't connect to server after " + + maxWaitMs + " ms"); } @Test