Skip to content

Commit 24a9f97

Browse files
authored
Chart: Extend image tests. (#12025)
1 parent 7b8d293 commit 24a9f97

File tree

3 files changed

+78
-4
lines changed

3 files changed

+78
-4
lines changed

charts/ingress-nginx/tests/controller-daemonset_test.yaml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,34 @@ tests:
148148
path: spec.template.spec.containers[0].securityContext.runAsGroup
149149
value: 1000
150150

151+
- it: should create a DaemonSet with a custom registry if `controller.image.registry` is set
152+
set:
153+
controller.kind: DaemonSet
154+
controller.image.registry: custom.registry.io
155+
controller.image.tag: v1.0.0-dev
156+
controller.image.digest: sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
157+
asserts:
158+
- equal:
159+
path: spec.template.spec.containers[0].image
160+
value: custom.registry.io/ingress-nginx/controller:v1.0.0-dev@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
161+
162+
- it: should create a DaemonSet with a custom image if `controller.image.image` is set
163+
set:
164+
controller.kind: DaemonSet
165+
controller.image.image: custom-repo/custom-image
166+
controller.image.tag: v1.0.0-dev
167+
controller.image.digest: sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
168+
asserts:
169+
- equal:
170+
path: spec.template.spec.containers[0].image
171+
value: registry.k8s.io/custom-repo/custom-image:v1.0.0-dev@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
172+
151173
- it: should create a DaemonSet with a custom tag if `controller.image.tag` is set
152174
set:
153175
controller.kind: DaemonSet
154-
controller.image.tag: my-little-custom-tag
176+
controller.image.tag: custom-tag
155177
controller.image.digest: sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
156178
asserts:
157179
- equal:
158180
path: spec.template.spec.containers[0].image
159-
value: registry.k8s.io/ingress-nginx/controller:my-little-custom-tag@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
181+
value: registry.k8s.io/ingress-nginx/controller:custom-tag@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd

charts/ingress-nginx/tests/controller-deployment_test.yaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,34 @@ tests:
169169
path: spec.template.spec.containers[0].securityContext.runAsGroup
170170
value: 1000
171171

172+
- it: should create a Deployment with a custom registry if `controller.image.registry` is set
173+
set:
174+
controller.image.registry: custom.registry.io
175+
controller.image.tag: v1.0.0-dev
176+
controller.image.digest: sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
177+
asserts:
178+
- equal:
179+
path: spec.template.spec.containers[0].image
180+
value: custom.registry.io/ingress-nginx/controller:v1.0.0-dev@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
181+
182+
- it: should create a Deployment with a custom image if `controller.image.image` is set
183+
set:
184+
controller.image.image: custom-repo/custom-image
185+
controller.image.tag: v1.0.0-dev
186+
controller.image.digest: sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
187+
asserts:
188+
- equal:
189+
path: spec.template.spec.containers[0].image
190+
value: registry.k8s.io/custom-repo/custom-image:v1.0.0-dev@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
191+
172192
- it: should create a Deployment with a custom tag if `controller.image.tag` is set
173193
set:
174-
controller.image.tag: my-little-custom-tag
194+
controller.image.tag: custom-tag
175195
controller.image.digest: sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
176196
asserts:
177197
- equal:
178198
path: spec.template.spec.containers[0].image
179-
value: registry.k8s.io/ingress-nginx/controller:my-little-custom-tag@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
199+
value: registry.k8s.io/ingress-nginx/controller:custom-tag@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
180200

181201
- it: should create a Deployment with `progressDeadlineSeconds` if `controller.progressDeadlineSeconds` is set
182202
set:

charts/ingress-nginx/tests/default-backend-deployment_test.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,35 @@ tests:
144144
- equal:
145145
path: spec.template.spec.containers[0].securityContext.runAsGroup
146146
value: 1000
147+
148+
- it: should create a Deployment with a custom registry if `defaultBackend.image.registry` is set
149+
set:
150+
defaultBackend.enabled: true
151+
defaultBackend.image.registry: custom.registry.io
152+
defaultBackend.image.tag: v1.0.0-dev
153+
defaultBackend.image.digest: sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
154+
asserts:
155+
- equal:
156+
path: spec.template.spec.containers[0].image
157+
value: custom.registry.io/defaultbackend-amd64:v1.0.0-dev@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
158+
159+
- it: should create a Deployment with a custom image if `defaultBackend.image.image` is set
160+
set:
161+
defaultBackend.enabled: true
162+
defaultBackend.image.image: custom-repo/custom-image
163+
defaultBackend.image.tag: v1.0.0-dev
164+
defaultBackend.image.digest: sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
165+
asserts:
166+
- equal:
167+
path: spec.template.spec.containers[0].image
168+
value: registry.k8s.io/custom-repo/custom-image:v1.0.0-dev@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
169+
170+
- it: should create a Deployment with a custom tag if `defaultBackend.image.tag` is set
171+
set:
172+
defaultBackend.enabled: true
173+
defaultBackend.image.tag: custom-tag
174+
defaultBackend.image.digest: sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
175+
asserts:
176+
- equal:
177+
path: spec.template.spec.containers[0].image
178+
value: registry.k8s.io/defaultbackend-amd64:custom-tag@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd

0 commit comments

Comments
 (0)