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;
}
Aggregations