|
@@ -5,6 +5,7 @@
|
|
|
|
|
|
package io.opentelemetry.smoketest;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.time.Duration;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
@@ -12,6 +13,8 @@ import java.util.Map;
|
|
|
import java.util.function.Consumer;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.testcontainers.containers.Container;
|
|
|
+import org.testcontainers.containers.ContainerLaunchException;
|
|
|
import org.testcontainers.containers.GenericContainer;
|
|
|
import org.testcontainers.containers.Network;
|
|
|
import org.testcontainers.containers.output.OutputFrame;
|
|
@@ -22,6 +25,7 @@ import org.testcontainers.utility.DockerImageName;
|
|
|
import org.testcontainers.utility.MountableFile;
|
|
|
|
|
|
public class LinuxTestContainerManager extends AbstractTestContainerManager {
|
|
|
+ private static final Logger logger = LoggerFactory.getLogger(LinuxTestContainerManager.class);
|
|
|
private static final Logger backendLogger = LoggerFactory.getLogger("Backend");
|
|
|
private static final Logger appLogger = LoggerFactory.getLogger("App");
|
|
|
|
|
@@ -110,7 +114,24 @@ public class LinuxTestContainerManager extends AbstractTestContainerManager {
|
|
|
target = target.withCommand(command);
|
|
|
}
|
|
|
|
|
|
- target.start();
|
|
|
+ try {
|
|
|
+ target.start();
|
|
|
+ } catch (ContainerLaunchException launchException) {
|
|
|
+ // when container failed to start try to force a thread dump
|
|
|
+ try {
|
|
|
+ Container.ExecResult execResult = target.execInContainer("killall", "-3", "java");
|
|
|
+ if (execResult.getExitCode() != 0) {
|
|
|
+ logger.warn("Command execution failed {}", execResult);
|
|
|
+ }
|
|
|
+ } catch (IOException exception) {
|
|
|
+ logger.warn("Command execution failed", exception);
|
|
|
+ } catch (InterruptedException exception) {
|
|
|
+ Thread.currentThread().interrupt();
|
|
|
+ }
|
|
|
+
|
|
|
+ throw launchException;
|
|
|
+ }
|
|
|
+
|
|
|
return output;
|
|
|
}
|
|
|
|