# HG changeset patch # User sgehwolf # Date 1562953045 -7200 # Node ID 6d9f5328694b8228dcc66a389578a9e001db070a # Parent 48a018a40f074d64508753f9e50e44d934c8280b 8227642: [TESTBUG] Make docker tests podman compatible Reviewed-by: mseledtsov, iignatyev, phh diff -r 48a018a40f07 -r 6d9f5328694b test/testlibrary/com/oracle/java/testlibrary/DockerTestUtils.java --- a/test/testlibrary/com/oracle/java/testlibrary/DockerTestUtils.java Fri Sep 25 17:16:38 2020 +0000 +++ b/test/testlibrary/com/oracle/java/testlibrary/DockerTestUtils.java Fri Jul 12 19:37:25 2019 +0200 @@ -47,11 +47,6 @@ private static boolean isDockerEngineAvailable = false; private static boolean wasDockerEngineChecked = false; - // Use this property to specify docker location on your system. - // E.g.: "/usr/local/bin/docker". - private static final String DOCKER_COMMAND = - System.getProperty("jdk.test.docker.command", "docker"); - // Set this property to true to retain image after test. By default // images are removed after test execution completes. // Retaining the image can be useful for diagnostics and image inspection. @@ -111,7 +106,7 @@ */ private static boolean isDockerEngineAvailableCheck() throws Exception { try { - execute(DOCKER_COMMAND, "ps") + execute(Platform.DOCKER_COMMAND, "ps") .shouldHaveExitValue(0) .shouldContain("CONTAINER") .shouldContain("IMAGE"); @@ -172,9 +167,8 @@ DockerfileConfig.getBaseImageVersion()); // Build the docker - execute(DOCKER_COMMAND, "build", "--no-cache", "--tag", imageName, buildDir.toString()) - .shouldHaveExitValue(0) - .shouldContain("Successfully built"); + execute(Platform.DOCKER_COMMAND, "build", "--no-cache", "--tag", imageName, buildDir.toString()) + .shouldHaveExitValue(0); } @@ -189,7 +183,7 @@ public static OutputAnalyzer dockerRunJava(DockerRunOptions opts) throws Exception { ArrayList cmd = new ArrayList<>(); - cmd.add(DOCKER_COMMAND); + cmd.add(Platform.DOCKER_COMMAND); cmd.add("run"); if (opts.tty) cmd.add("--tty=true"); @@ -218,7 +212,7 @@ * @throws Exception */ public static void removeDockerImage(String imageNameAndTag) throws Exception { - execute(DOCKER_COMMAND, "rmi", "--force", imageNameAndTag); + execute(Platform.DOCKER_COMMAND, "rmi", "--force", imageNameAndTag); } diff -r 48a018a40f07 -r 6d9f5328694b test/testlibrary/com/oracle/java/testlibrary/Platform.java --- a/test/testlibrary/com/oracle/java/testlibrary/Platform.java Fri Sep 25 17:16:38 2020 +0000 +++ b/test/testlibrary/com/oracle/java/testlibrary/Platform.java Fri Jul 12 19:37:25 2019 +0200 @@ -28,6 +28,12 @@ import com.oracle.java.testlibrary.Utils; public class Platform { + // Use this property to specify docker location on your system. + // E.g.: "/usr/local/bin/docker". We define this constant here so + // that it can be used in VMProps as well which checks docker support + // via this command + public static final String DOCKER_COMMAND = + System.getProperty("jdk.test.docker.command", "docker"); private static final String osName = System.getProperty("os.name"); private static final String dataModel = System.getProperty("sun.arch.data.model"); private static final String vmVersion = System.getProperty("java.vm.version");