RFR: 8302888: containers/docker/TestJcmd.java fails when run as root under podman
David Holmes
dholmes at openjdk.org
Mon Feb 20 22:48:25 UTC 2023
On Mon, 20 Feb 2023 17:33:51 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
> Could I please get a review of this trivial test fix? When `podman` is being used and the test is being run as root, which some of the other container tests require, the test fails because of the not-supported `--userns=keep-id` option:
>
>
> # id -u
> 0
> # podman run --rm -ti --userns=keep-id fedora:37
> Error: keep-id is only supported in rootless mode
>
>
> I propose to only add it when non-root.
>
> Testing:
>
> - [x] Ran the test with podman as root/regular user. Both passed. It failed before when run as root.
test/hotspot/jtreg/containers/docker/TestJcmd.java line 173:
> 171:
> 172: String uid = getId("-u");
> 173: if (IS_PODMAN && !ROOT_UID.equals(uid)) {
Suggestion - to avoid execution in non-podman case:
if (IS_PODMAN && !ROOT_UID.equals(getId("-u"))) {
Alternatively in `generateCustomDockerfile` we could always check the uid and stash that away for later use here?
-------------
PR: https://git.openjdk.org/jdk/pull/12673
More information about the hotspot-runtime-dev
mailing list