From ddffd8e38933c422f775719a7f67ee12f31ea7ef Mon Sep 17 00:00:00 2001 From: Cheng Gu Date: Mon, 11 Aug 2025 22:28:20 +0000 Subject: [PATCH] Allow IfNotPresent to be used in node e2e tests Currently the node e2e tests overrides the image pull policy to PullNever, if the policy is not PullAlways. --- test/e2e/framework/pod/pod_client.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/test/e2e/framework/pod/pod_client.go b/test/e2e/framework/pod/pod_client.go index 664eae425ca..16f96e23ddd 100644 --- a/test/e2e/framework/pod/pod_client.go +++ b/test/e2e/framework/pod/pod_client.go @@ -271,18 +271,13 @@ func (c *PodClient) mungeSpec(pod *v1.Pod) { // during the test. for i := range pod.Spec.Containers { c := &pod.Spec.Containers[i] - if c.ImagePullPolicy == v1.PullAlways { - // If the image pull policy is PullAlways, the image doesn't need to be in - // the allow list or pre-pulled, because the image is expected to be pulled - // in the test anyway. - continue + if c.ImagePullPolicy == v1.PullNever { + // If the image pull policy is PullNever, make sure it is in the pre-pull list. + gomega.Expect(ImagePrePullList.Has(c.Image)).To(gomega.BeTrueBecause("Image %q is not in the pre-pull list, consider adding it to PrePulledImages in test/e2e/common/util.go or NodePrePullImageList in test/e2e_node/image_list.go", c.Image)) } - // If the image policy is not PullAlways, the image must be in the pre-pull list and - // pre-pulled. - gomega.Expect(ImagePrePullList.Has(c.Image)).To(gomega.BeTrueBecause("Image %q is not in the pre-pull list, consider adding it to PrePulledImages in test/e2e/common/util.go or NodePrePullImageList in test/e2e_node/image_list.go", c.Image)) - // Do not pull images during the tests because the images in pre-pull list should have - // been prepulled. - c.ImagePullPolicy = v1.PullNever + // If the image pull policy is PullAlways or PullIfNotPresent, the image doesn't need + // to be in the allow list or pre-pulled, because the image is expected to be pulled + // in the test anyway. } }