Files
chart/library/common-test/tests/container/image_test.yaml
Stavros Kois 929e60d801 NAS-121003 / 23.10 / Adapt charts CI and improve/fix common (#1011)
* Adapt charts CI and improve/fix common

* add check on permissions contaienr

* add postgres template

* update comments

* Update create_app.sh

* add check

* update script

* auto gen item.yaml from Chart,yaml

* rename readme on dest

* duplicate readme from the same source

* correct comment

* reoder

* remove extra space

* keep both README and app-readme

* update regex, to also allow 2 letter names, which is also valid

* No need to check host network if there aren't any pod values

* use same pattern as the pod.name label (not prepending release-name

* update deps

* add chart dirs to ci

* Add a validation to check if there is any yaml errors after merging files

* update charts path on ci

* common/1.0.0/ -> common/

* update common-test dep path

* temp update create_app script

* make permissions container name configurable, incase we want to change order of execution

* update naming convention

* fix typo and a missed name change

* do not allow `--` in names
2023-03-16 17:36:19 +02:00

161 lines
4.4 KiB
YAML

suite: container image test
templates:
- common.yaml
tests:
- it: should generate correct image
set:
imageDictToUse: image
image: &image
repository: nginx
tag: "1.19.0"
pullPolicy: IfNotPresent
imageGPU:
repository: some-gpu-image
tag: "5.20"
pullPolicy: Always
workload:
workload-name:
enabled: true
primary: true
type: Deployment
podSpec:
containers:
container-name1:
enabled: true
primary: true
imageSelector: "{{ .Values.imageDictToUse }}"
probes: &probes
liveness:
enabled: false
readiness:
enabled: false
startup:
enabled: false
container-name2:
enabled: true
primary: false
imageSelector: imageGPU
probes: *probes
asserts:
- documentIndex: &deploymentDoc 0
isKind:
of: Deployment
- documentIndex: *deploymentDoc
isAPIVersion:
of: apps/v1
- documentIndex: *deploymentDoc
isSubset:
path: spec.template.spec.containers[0]
content:
image: nginx:1.19.0
imagePullPolicy: IfNotPresent
- documentIndex: *deploymentDoc
isSubset:
path: spec.template.spec.containers[1]
content:
image: some-gpu-image:5.20
imagePullPolicy: Always
# Failures
- it: should fail with imageSelector trying to access non-existent image
set:
image: *image
workload:
workload-name:
enabled: true
primary: true
type: Deployment
podSpec:
containers:
container-name1:
enabled: true
primary: true
imageSelector: image-dict-that-does-not-exist
asserts:
- failedTemplate:
errorMessage: Container - Expected <.Values.image-dict-that-does-not-exist> to exist
- it: should fail with empty repository in selected image
set:
image:
repository: ""
tag: 1.19.0
pullPolicy: IfNotPresent
workload:
workload-name:
enabled: true
primary: true
type: Deployment
podSpec:
containers:
container-name1:
enabled: true
primary: true
imageSelector: image
asserts:
- failedTemplate:
errorMessage: Container - Expected non-empty <.Values.image.repository>
- it: should fail with empty tag in selected image
set:
image:
repository: nginx
tag: ""
pullPolicy: IfNotPresent
workload:
workload-name:
enabled: true
primary: true
type: Deployment
podSpec:
containers:
container-name1:
enabled: true
primary: true
imageSelector: image
asserts:
- failedTemplate:
errorMessage: Container - Expected non-empty <.Values.image.tag>
- it: should fail with invalid pullPolicy selected image
set:
image:
repository: nginx
tag: "1.19.0"
pullPolicy: invalid
workload:
workload-name:
enabled: true
primary: true
type: Deployment
podSpec:
containers:
container-name1:
enabled: true
primary: true
imageSelector: image
asserts:
- failedTemplate:
errorMessage: Container - Expected <.Values.image.pullPolicy> to be one of [IfNotPresent, Always, Never], but got [invalid]
- it: should fail with tag not string on selected image
set:
image:
repository: nginx
tag: 1.19
pullPolicy: invalid
workload:
workload-name:
enabled: true
primary: true
type: Deployment
podSpec:
containers:
container-name1:
enabled: true
primary: true
imageSelector: image
asserts:
- failedTemplate:
errorMessage: Container - Expected <.Values.image.tag> to be string, but got [float64]