< prev index next >
test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java
Print this page
@ rev 55664 : 8227642: [TESTBUG] Make docker tests podman compatible
| Reviewed-by: duke
~
@@ -35,10 +35,11 @@
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import jdk.test.lib.Utils;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jtreg.SkippedException;
@@ -178,12 +179,11 @@
DockerfileConfig.getBaseImageName(),
DockerfileConfig.getBaseImageVersion());
try {
// Build the docker
execute(DOCKER_COMMAND, "build", "--no-cache", "--tag", imageName, buildDir.toString())
- .shouldHaveExitValue(0)
- .shouldContain("Successfully built");
+ .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.
throw new SkippedException("Building docker image failed. Details: \n" + e.getMessage());
@@ -269,10 +269,14 @@
* @throws Exception
*/
public static OutputAnalyzer execute(String... command) throws Exception {
ProcessBuilder pb = new ProcessBuilder(command);
+ // Add /usr/sbin to PATH so as to allow for podman compatibility
+ // which relies on iptables being on the PATH
+ Map<String, String> env = pb.environment();
+ env.put("PATH", System.getenv("PATH") + ":/usr/sbin");
System.out.println("[COMMAND]\n" + Utils.getCommandLine(pb));
long started = System.currentTimeMillis();
Process p = pb.start();
long pid = p.pid();
< prev index next >