Search in sources :

Example 6 with ContainerInfo

use of com.microsoft.applicationinsights.smoketest.docker.ContainerInfo in project ApplicationInsights-Java by microsoft.

the class AiSmokeTest method waitForApplicationToStart.

protected static void waitForApplicationToStart() throws Exception {
    ContainerInfo containerInfo = currentContainerInfo.get();
    try {
        System.out.printf("Test app health check: Waiting for %s to start...%n", warFileName);
        String contextRootUrl = getBaseUrl() + "/";
        waitForUrlWithRetries(contextRootUrl, APPLICATION_READY_TIMEOUT_SECONDS, TimeUnit.SECONDS, String.format("%s on %s", getAppContext(), containerInfo.getImageName()), HEALTH_CHECK_RETRIES);
        System.out.println("Test app health check complete.");
        waitForHealthCheckTelemetryIfNeeded(contextRootUrl);
    } catch (Exception e) {
        for (ContainerInfo container : allContainers) {
            System.out.println("========== dumping container log: " + container.getContainerId());
            AiDockerClient.printContainerLogs(container.getContainerId());
            System.out.println("end of container log ==========");
        }
        throw e;
    } finally {
        mockedIngestion.resetData();
    }
}
Also used : ContainerInfo(com.microsoft.applicationinsights.smoketest.docker.ContainerInfo) TimeoutException(com.microsoft.applicationinsights.smoketest.exceptions.TimeoutException) SmokeTestException(com.microsoft.applicationinsights.smoketest.exceptions.SmokeTestException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

ContainerInfo (com.microsoft.applicationinsights.smoketest.docker.ContainerInfo)6 SmokeTestException (com.microsoft.applicationinsights.smoketest.exceptions.SmokeTestException)4 TimeoutException (com.microsoft.applicationinsights.smoketest.exceptions.TimeoutException)3 IOException (java.io.IOException)3 ExecutionException (java.util.concurrent.ExecutionException)3 HashMap (java.util.HashMap)2 BeforeWithParams (com.microsoft.applicationinsights.smoketest.fixtures.BeforeWithParams)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Random (java.util.Random)1