diff --git a/test/hotspot/jtreg/containers/docker/TestPids.java b/test/hotspot/jtreg/containers/docker/TestPids.java index df31b2ad09111..8a62f3eb935eb 100644 --- a/test/hotspot/jtreg/containers/docker/TestPids.java +++ b/test/hotspot/jtreg/containers/docker/TestPids.java @@ -40,11 +40,15 @@ import jdk.test.lib.containers.docker.DockerRunOptions; import jdk.test.lib.containers.docker.DockerTestUtils; import jdk.test.lib.Asserts; +import jdk.test.lib.Container; import jdk.test.lib.Platform; import jdk.test.lib.Utils; public class TestPids { private static final String imageName = Common.imageName("pids"); + private static final boolean IS_PODMAN = Container.ENGINE_COMMAND.contains("podman"); + private static final int UNLIMITED_PIDS_PODMAN = 0; + private static final int UNLIMITED_PIDS_DOCKER = -1; public static void main(String[] args) throws Exception { if (!DockerTestUtils.canTestDocker()) { @@ -126,7 +130,8 @@ private static void testPids(String value) throws Exception { DockerRunOptions opts = commonOpts(); if (value.equals("Unlimited")) { - opts.addDockerOpts("--pids-limit=-1"); + int unlimited = IS_PODMAN ? UNLIMITED_PIDS_PODMAN : UNLIMITED_PIDS_DOCKER; + opts.addDockerOpts("--pids-limit=" + unlimited); } else { opts.addDockerOpts("--pids-limit="+value); } diff --git a/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java b/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java index 99ef9d0cf8c52..6c6ff76fa9998 100644 --- a/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java +++ b/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java @@ -39,9 +39,13 @@ import jdk.test.lib.containers.docker.DockerTestUtils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Asserts; +import jdk.test.lib.Container; public class TestPidsLimit { private static final String imageName = Common.imageName("pids"); + private static final boolean IS_PODMAN = Container.ENGINE_COMMAND.contains("podman"); + private static final int UNLIMITED_PIDS_PODMAN = 0; + private static final int UNLIMITED_PIDS_DOCKER = -1; public static void main(String[] args) throws Exception { if (!DockerTestUtils.canTestDocker()) { @@ -107,7 +111,8 @@ private static void testPidsLimit(String pidsLimit) throws Exception { Common.logNewTestCase("testPidsLimit (limit: " + pidsLimit + ")"); DockerRunOptions opts = Common.newOptsShowSettings(imageName); if (pidsLimit.equals("Unlimited")) { - opts.addDockerOpts("--pids-limit=-1"); + int unlimited = IS_PODMAN ? UNLIMITED_PIDS_PODMAN : UNLIMITED_PIDS_DOCKER; + opts.addDockerOpts("--pids-limit=" + unlimited); } else { opts.addDockerOpts("--pids-limit="+pidsLimit); }