Search in sources :

Example 1 with SmokeTestException

use of com.microsoft.applicationinsights.smoketest.exceptions.SmokeTestException in project ApplicationInsights-Java by microsoft.

the class AiSmokeTest method generateAppContainerEnvVarMap.

private static Map<String, String> generateAppContainerEnvVarMap() {
    Map<String, String> map = new HashMap<>();
    if (agentMode != null) {
        map.put("AI_AGENT_MODE", agentMode);
    }
    for (ContainerInfo info : allContainers) {
        if (!info.isDependency()) {
            continue;
        }
        DependencyContainer dc = info.getDependencyContainerInfo();
        String varname = dc.hostnameEnvironmentVariable();
        if (varname.isEmpty()) {
            varname = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, dc.value());
        }
        String containerName = info.getContainerName();
        if (containerName == null || containerName.isEmpty()) {
            throw new SmokeTestException("Null/empty container name for dependency container");
        }
        map.put(varname, containerName);
        System.out.printf("Adding env var to test app container: %s=%s%n", varname, containerName);
    }
    return map;
}
Also used : SmokeTestException(com.microsoft.applicationinsights.smoketest.exceptions.SmokeTestException) HashMap(java.util.HashMap) ContainerInfo(com.microsoft.applicationinsights.smoketest.docker.ContainerInfo)

Aggregations

ContainerInfo (com.microsoft.applicationinsights.smoketest.docker.ContainerInfo)1 SmokeTestException (com.microsoft.applicationinsights.smoketest.exceptions.SmokeTestException)1 HashMap (java.util.HashMap)1