8351382: New test containers/docker/TestMemoryWithSubgroups.java is failing

Reviewed-by: sgehwolf, dholmes
This commit is contained in:
Sergey Chernyshev 2025-03-18 09:37:45 +00:00 committed by Severin Gehwolf
parent 558c015c99
commit 46b3d1d8cf

View File

@ -21,6 +21,7 @@
* questions.
*/
import jdk.test.lib.Container;
import jdk.test.lib.containers.docker.Common;
import jdk.test.lib.containers.docker.DockerTestUtils;
import jdk.test.lib.containers.docker.DockerRunOptions;
@ -46,6 +47,19 @@ public class TestMemoryWithSubgroups {
private static final String imageName = Common.imageName("subgroup");
static String getEngineInfo(String format) throws Exception {
return DockerTestUtils.execute(Container.ENGINE_COMMAND, "info", "-f", format)
.getStdout();
}
static boolean isRootless() throws Exception {
// Docker and Podman have different INFO structures.
// The node path for Podman is .Host.Security.Rootless, that also holds for
// Podman emulating Docker CLI. The node path for Docker is .SecurityOptions.
return (getEngineInfo("{{.Host.Security.Rootless}}").contains("true") ||
getEngineInfo("{{.SecurityOptions}}").contains("name=rootless"));
}
public static void main(String[] args) throws Exception {
Metrics metrics = Metrics.systemMetrics();
if (metrics == null) {
@ -56,6 +70,9 @@ public class TestMemoryWithSubgroups {
System.out.println("Unable to run docker tests.");
return;
}
if (isRootless()) {
throw new SkippedException("Test skipped in rootless mode");
}
Common.prepareWhiteBox();
DockerTestUtils.buildJdkContainerImage(imageName);