RFR: 8371503: RETAIN_IMAGE_AFTER_TEST do not work for some tests

David Holmes dholmes at openjdk.org
Mon Dec 15 05:38:52 UTC 2025


On Sat, 8 Nov 2025 08:10:45 GMT, SendaoYan <syan at openjdk.org> wrote:

> Hi all,
> 
> The DockerTestUtils.RETAIN_IMAGE_AFTER_TEST variable which read the property from "jdk.test.docker.retain.image" do not work for some of the docker tests, such as jdk/internal/platform/docker/TestDockerCpuMetrics.java, only works for some of the docker tests, such as jdk/internal/platform/docker/TestPidsLimit.java.
> 
> This PR read the DockerTestUtils.RETAIN_IMAGE_AFTER_TEST inside function removeDockerImage instead of before all the fucntion removeDockerImage. This will make all the docker tests receive the property jdk.test.docker.retain.image.
> 
> Change has been verified locally on linux-x64 by run the all touched tests.

I'm unclear what you mean by some of the tests not working - are you saying those tests did not check the value of RETAIN_IMAGE_AFTER_TEST? Or that they never had it passed in - in which case why not? Where does it come from.

test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java line 255:

> 253:             if(!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
> 254:                 execute(Container.ENGINE_COMMAND, "rmi", "--force", imageNameAndTag);
> 255:             }

Pre-existing but indent is too big

-------------

PR Review: https://git.openjdk.org/jdk/pull/28208#pullrequestreview-3576429184
PR Review Comment: https://git.openjdk.org/jdk/pull/28208#discussion_r2617997460


More information about the serviceability-dev mailing list