Skip to content
Open
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
6 changes: 2 additions & 4 deletions test/hotspot/jtreg/containers/docker/DockerBasicTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -56,9 +56,7 @@ public static void main(String[] args) throws Exception {
testHelloDocker();
testJavaVersionWithCgMounts();
} finally {
if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
DockerTestUtils.removeDockerImage(imageNameAndTag);
}
DockerTestUtils.removeDockerImage(imageNameAndTag);
}
}

Expand Down
6 changes: 2 additions & 4 deletions test/hotspot/jtreg/containers/docker/ShareTmpDir.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -59,9 +59,7 @@ public static void main(String[] args) throws Exception {
try {
test();
} finally {
if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
DockerTestUtils.removeDockerImage(imageName);
}
DockerTestUtils.removeDockerImage(imageName);
}
}

Expand Down
6 changes: 2 additions & 4 deletions test/hotspot/jtreg/containers/docker/TestCPUAwareness.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -86,9 +86,7 @@ public static void main(String[] args) throws Exception {
}

} finally {
if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
DockerTestUtils.removeDockerImage(imageName);
}
DockerTestUtils.removeDockerImage(imageName);
}
}

Expand Down
6 changes: 2 additions & 4 deletions test/hotspot/jtreg/containers/docker/TestLimitsUpdating.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2023, Red Hat, Inc.
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -64,9 +64,7 @@ public static void main(String[] args) throws Exception {
try {
testLimitUpdates();
} finally {
if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
DockerTestUtils.removeDockerImage(imageName);
}
DockerTestUtils.removeDockerImage(imageName);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ public static void main(String[] args) throws Exception {
testMetricsSwapExceedingPhysical();
testContainerMemExceedsPhysical();
} finally {
if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
DockerTestUtils.removeDockerImage(imageName);
}
DockerTestUtils.removeDockerImage(imageName);
}
}

Expand Down
6 changes: 2 additions & 4 deletions test/hotspot/jtreg/containers/docker/TestPids.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -64,9 +64,7 @@ public static void main(String[] args) throws Exception {
try {
testPids();
} finally {
if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
DockerTestUtils.removeDockerImage(imageName);
}
DockerTestUtils.removeDockerImage(imageName);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ public static void main(String[] args) throws Exception {
testMemorySoftLimit("500m","200m");

} finally {
if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
DockerTestUtils.removeDockerImage(imageName);
}
DockerTestUtils.removeDockerImage(imageName);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ public static void main(String[] args) throws Exception {
"150M", Integer.toString(0)
);
} finally {
if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
DockerTestUtils.removeDockerImage(imageName);
}
DockerTestUtils.removeDockerImage(imageName);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ public static void main(String[] args) throws Exception {
try {
testLimitUpdates();
} finally {
if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
DockerTestUtils.removeDockerImage(imageName);
}
DockerTestUtils.removeDockerImage(imageName);
}
}

Expand Down
4 changes: 1 addition & 3 deletions test/jdk/jdk/internal/platform/docker/TestPidsLimit.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ public static void main(String[] args) throws Exception {
testPidsLimit("2000");
testPidsLimit("Unlimited");
} finally {
if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
DockerTestUtils.removeDockerImage(imageName);
}
DockerTestUtils.removeDockerImage(imageName);
}
}

Expand Down
6 changes: 4 additions & 2 deletions test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -250,7 +250,9 @@ public static OutputAnalyzer dockerRunJava(DockerRunOptions opts) throws Excepti
* @throws Exception
*/
public static void removeDockerImage(String imageNameAndTag) throws Exception {
execute(Container.ENGINE_COMMAND, "rmi", "--force", imageNameAndTag);
if(!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
execute(Container.ENGINE_COMMAND, "rmi", "--force", imageNameAndTag);
}
}


Expand Down