< prev index next >

test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java

Print this page
@  rev 55754 : 8228434: jdk/net/Sockets/Test.java fails after JDK-8227642
|  Summary: Move container constant to separate test lib class
~  Reviewed-by: duke
o  rev 55753 : 8228434: jdk/net/Sockets/Test.java fails after JDK-8227642
|  Reviewed-by: duke
~

*** 35,45 **** import java.nio.file.attribute.BasicFileAttributes; import java.util.Arrays; import java.util.ArrayList; import java.util.Collections; import java.util.List; ! import jdk.test.lib.Platform; import jdk.test.lib.Utils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; import jtreg.SkippedException; --- 35,45 ---- import java.nio.file.attribute.BasicFileAttributes; import java.util.Arrays; import java.util.ArrayList; import java.util.Collections; import java.util.List; ! import jdk.test.lib.Container; import jdk.test.lib.Utils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; import jtreg.SkippedException;
*** 110,120 **** * @return true if docker engine is available and usable * @throws Exception */ private static boolean isDockerEngineAvailableCheck() throws Exception { try { ! execute(Platform.DOCKER_COMMAND, "ps") .shouldHaveExitValue(0) .shouldContain("CONTAINER") .shouldContain("IMAGE"); } catch (Exception e) { return false; --- 110,120 ---- * @return true if docker engine is available and usable * @throws Exception */ private static boolean isDockerEngineAvailableCheck() throws Exception { try { ! execute(Container.ENGINE_COMMAND, "ps") .shouldHaveExitValue(0) .shouldContain("CONTAINER") .shouldContain("IMAGE"); } catch (Exception e) { return false;
*** 173,183 **** generateDockerFile(buildDir.resolve("Dockerfile"), DockerfileConfig.getBaseImageName(), DockerfileConfig.getBaseImageVersion()); try { // Build the docker ! execute(Platform.DOCKER_COMMAND, "build", "--no-cache", "--tag", imageName, buildDir.toString()) .shouldHaveExitValue(0); } catch (Exception e) { // If docker image building fails there is a good chance it happens due to environment and/or // configuration other than product failure. Throw jtreg skipped exception in such case // instead of failing the test. --- 173,183 ---- generateDockerFile(buildDir.resolve("Dockerfile"), DockerfileConfig.getBaseImageName(), DockerfileConfig.getBaseImageVersion()); try { // Build the docker ! execute(Container.ENGINE_COMMAND, "build", "--no-cache", "--tag", imageName, buildDir.toString()) .shouldHaveExitValue(0); } catch (Exception e) { // If docker image building fails there is a good chance it happens due to environment and/or // configuration other than product failure. Throw jtreg skipped exception in such case // instead of failing the test.
*** 195,205 **** * @throws Exception */ public static List<String> buildJavaCommand(DockerRunOptions opts) throws Exception { List<String> cmd = new ArrayList<>(); ! cmd.add(Platform.DOCKER_COMMAND); cmd.add("run"); if (opts.tty) cmd.add("--tty=true"); if (opts.removeContainerAfterUse) cmd.add("--rm"); --- 195,205 ---- * @throws Exception */ public static List<String> buildJavaCommand(DockerRunOptions opts) throws Exception { List<String> cmd = new ArrayList<>(); ! cmd.add(Container.ENGINE_COMMAND); cmd.add("run"); if (opts.tty) cmd.add("--tty=true"); if (opts.removeContainerAfterUse) cmd.add("--rm");
*** 237,247 **** * * @param DockerRunOptions optins for running docker * @throws Exception */ public static void removeDockerImage(String imageNameAndTag) throws Exception { ! execute(Platform.DOCKER_COMMAND, "rmi", "--force", imageNameAndTag); } /** --- 237,247 ---- * * @param DockerRunOptions optins for running docker * @throws Exception */ public static void removeDockerImage(String imageNameAndTag) throws Exception { ! execute(Container.ENGINE_COMMAND, "rmi", "--force", imageNameAndTag); } /**
< prev index next >