Skip to content

Commit

Permalink
8274506: TestPids.java and TestPidsLimit.java fail with podman run as…
Browse files Browse the repository at this point in the history
… root

Reviewed-by: mbaesken, cjplummer
  • Loading branch information
jerboaa committed Sep 30, 2021
1 parent a8210c5 commit 94e31e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
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;

static final String warning_kernel_no_pids_support = "WARNING: Your kernel does not support pids limit capabilities";

Expand Down Expand Up @@ -139,7 +143,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

5 comments on commit 94e31e5

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MBaesken
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 94e31e5 Jan 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MBaesken the backport was successfully created on the branch MBaesken-backport-94e31e5c in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 94e31e5c from the openjdk/jdk repository.

The commit being backported was authored by Severin Gehwolf on 30 Sep 2021 and was reviewed by Matthias Baesken and Chris Plummer.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev MBaesken-backport-94e31e5c:MBaesken-backport-94e31e5c
$ git checkout MBaesken-backport-94e31e5c
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev MBaesken-backport-94e31e5c

@MBaesken
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 94e31e5 Jun 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MBaesken the backport was successfully created on the branch MBaesken-backport-94e31e5c in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 94e31e5c from the openjdk/jdk repository.

The commit being backported was authored by Severin Gehwolf on 30 Sep 2021 and was reviewed by Matthias Baesken and Chris Plummer.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev MBaesken-backport-94e31e5c:MBaesken-backport-94e31e5c
$ git checkout MBaesken-backport-94e31e5c
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev MBaesken-backport-94e31e5c

Please sign in to comment.