Skip to content

Commit 9823fa8

Browse files
mergify[bot]ebaron
andauthored
test(agent): fix failing pull policy test on release (#1085) (#1086)
(cherry picked from commit 87c4869) Co-authored-by: Elliott Baron <ebaron@redhat.com>
1 parent ff8da81 commit 9823fa8

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

internal/webhooks/agent/pod_defaulter_test.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ var _ = Describe("PodDefaulter", func() {
107107
Expect(container.Env).To(Equal(expected.Env))
108108
Expect(container.EnvFrom).To(Equal(expected.EnvFrom))
109109
Expect(container.Image).To(HavePrefix(expected.Image[:strings.Index(expected.Image, ":")]))
110-
Expect(container.ImagePullPolicy).To(Equal(expected.ImagePullPolicy))
111110
Expect(container.VolumeMounts).To(Equal(expected.VolumeMounts))
112111
Expect(container.SecurityContext).To(Equal(expected.SecurityContext))
113112
Expect(container.Ports).To(Equal(expected.Ports))
@@ -277,6 +276,16 @@ var _ = Describe("PodDefaulter", func() {
277276
})
278277

279278
ExpectPod()
279+
280+
It("should use Always pull policy", func() {
281+
actual := t.getPod(expectedPod)
282+
expectedInitContainers := expectedPod.Spec.InitContainers
283+
Expect(actual.Spec.InitContainers).To(HaveLen(len(expectedInitContainers)))
284+
for idx := range expectedInitContainers {
285+
container := actual.Spec.InitContainers[idx]
286+
Expect(container.ImagePullPolicy).To(Equal(corev1.PullAlways))
287+
}
288+
})
280289
})
281290

282291
Context("for release", func() {
@@ -286,6 +295,16 @@ var _ = Describe("PodDefaulter", func() {
286295
})
287296

288297
ExpectPod()
298+
299+
It("should use IfNotPresent pull policy", func() {
300+
actual := t.getPod(expectedPod)
301+
expectedInitContainers := expectedPod.Spec.InitContainers
302+
Expect(actual.Spec.InitContainers).To(HaveLen(len(expectedInitContainers)))
303+
for idx := range expectedInitContainers {
304+
container := actual.Spec.InitContainers[idx]
305+
Expect(container.ImagePullPolicy).To(Equal(corev1.PullIfNotPresent))
306+
}
307+
})
289308
})
290309
})
291310

0 commit comments

Comments
 (0)