diff options
author | Arne H Juul <arnej@yahoo-inc.com> | 2017-05-26 13:28:15 +0200 |
---|---|---|
committer | Arne H Juul <arnej@yahoo-inc.com> | 2017-05-26 13:28:15 +0200 |
commit | 2dd83da154f1c1939b4a665c7cec544020531e3b (patch) | |
tree | 2903bdb86845b0d3614eab7e6995b919986f5342 /node-admin | |
parent | 35602e211e3232f9f143b689c57848fc50344d9c (diff) |
log more info in this test
* this test is unstable on factory, so dump some
more information in the log about what is happening.
Diffstat (limited to 'node-admin')
-rw-r--r-- | node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RunInContainerTest.java | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RunInContainerTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RunInContainerTest.java index 54d494caaef..30cffce1d03 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RunInContainerTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RunInContainerTest.java @@ -28,6 +28,7 @@ import java.nio.charset.StandardCharsets; import java.time.Instant; import java.util.Arrays; import java.util.Collections; +import java.util.logging.Logger; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.eq; @@ -39,6 +40,7 @@ import static org.mockito.Mockito.when; * @author dybis */ public class RunInContainerTest { + private final Logger logger = Logger.getLogger("RunInContainerTest"); private final Orchestrator orchestrator = ComponentsProviderWithMocks.orchestratorMock; private final String parentHostname = "localhost.test.yahoo.com"; private JDisc container; @@ -58,19 +60,24 @@ public class RunInContainerTest { doThrow(new RuntimeException()).when(orchestrator).resume(parentHostname); port = findRandomOpenPort(); System.out.println("PORT IS " + port); + logger.info("PORT IS " + port); container = JDisc.fromServicesXml(createServiceXml(port), Networking.enable); } @After - public void after() { - container.close(); + public void stopContainer() { + if (container != null) { + container.close(); + } } private boolean doPutCall(String command) throws IOException { + logger.info("info before '"+command+"' is: " + doGetInfoCall()); HttpClient httpclient = HttpClientBuilder.create().build(); HttpHost target = new HttpHost("localhost", port, "http"); HttpPut getRequest = new HttpPut("/rest/" + command); HttpResponse httpResponse = httpclient.execute(target, getRequest); + logger.info("info after '"+command+"' is: " + doGetInfoCall()); return httpResponse.getStatusLine().getStatusCode() == 200; } @@ -96,6 +103,7 @@ public class RunInContainerTest { if (httpResponse.getStatusLine().getStatusCode() != 200) { continue; } + logger.info("Container started."); System.out.println("Container started."); return; } catch (Exception e) { @@ -105,13 +113,6 @@ public class RunInContainerTest { throw new RuntimeException("Could not get answer from container."); } - @After - public void stopContainer() { - if (container != null) { - container.close(); - } - } - @Test public void testGetContainersToRunAPi() throws IOException, InterruptedException { doThrow(new OrchestratorException("Cannot suspend because...")).when(orchestrator).suspend(parentHostname); @@ -195,4 +196,4 @@ public class RunInContainerTest { " </jdisc>\n" + "</services>\n"; } -}
\ No newline at end of file +} |