Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8274506: TestPids.java and TestPidsLimit.java fail with podman run as root #5750

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion test/hotspot/jtreg/containers/docker/TestPids.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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);
}
Expand Down
7 changes: 6 additions & 1 deletion test/jdk/jdk/internal/platform/docker/TestPidsLimit.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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);
}
Expand Down