feat(common): Release 2.0.1 (#193)

This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2023-10-03 09:24:41 +02:00 committed by GitHub
parent bf5b623fa6
commit 66389dec8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 240 additions and 148 deletions

View file

@ -0,0 +1,42 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: Container validations
templates:
- common.yaml
tests:
- it: image required to be a dictionary
set:
controllers:
main:
containers:
test:
image: "test:latest"
asserts:
- failedTemplate:
errorMessage: "Image required to be a dictionary with repository and tag fields. (controller main, container test)"
- it: image repository is required
set:
controllers:
main:
containers:
test:
image:
repository: ""
tag: "test"
asserts:
- failedTemplate:
errorMessage: "No image repository specified for container. (controller main, container test)"
- it: image tag is required
set:
controllers:
main:
containers:
test:
image:
repository: test
tag: ""
asserts:
- failedTemplate:
errorMessage: "No image tag specified for container. (controller main, container test)"

View file

@ -183,3 +183,93 @@ tests:
name: config
mountPath: /dev
subPath: mySubPath
- it: volumeClaimTemplates with default mounts should pass
set:
controllers.main:
type: statefulset
statefulset:
volumeClaimTemplates:
- name: "storage"
accessMode: "ReadWriteOnce"
size: "10Gi"
storageClass: "storage"
asserts:
- documentIndex: &StatefulSetDoc 0
isKind:
of: StatefulSet
- documentIndex: *StatefulSetDoc
equal:
path: spec.template.spec.containers[0].volumeMounts[0]
value:
name: storage
mountPath: /storage
- it: volumeClaimTemplates with globalMounts should pass
set:
controllers.main:
type: statefulset
statefulset:
volumeClaimTemplates:
- name: "storage"
accessMode: "ReadWriteOnce"
size: "10Gi"
storageClass: "storage"
globalMounts:
- path: /tmp/storage
- path: /tmp/secondMountPoint
asserts:
- documentIndex: &StatefulSetDoc 0
isKind:
of: StatefulSet
- documentIndex: *StatefulSetDoc
equal:
path: spec.template.spec.containers[0].volumeMounts[0]
value:
name: storage
mountPath: /tmp/storage
- documentIndex: *StatefulSetDoc
equal:
path: spec.template.spec.containers[0].volumeMounts[1]
value:
name: storage
mountPath: /tmp/secondMountPoint
- it: volumeClaimTemplates with advancedMounts should pass
set:
controllers.main:
type: statefulset
statefulset:
volumeClaimTemplates:
- name: "storage"
accessMode: "ReadWriteOnce"
size: "10Gi"
storageClass: "storage"
advancedMounts:
second-container:
- path: /tmp/storage
- path: /tmp/secondMountPoint
containers:
second-container:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 30
asserts:
- documentIndex: &StatefulSetDoc 0
isKind:
of: StatefulSet
- documentIndex: *StatefulSetDoc
notExists:
path: spec.template.spec.containers[0].volumeMounts
- documentIndex: *StatefulSetDoc
equal:
path: spec.template.spec.containers[1].volumeMounts[0]
value:
name: storage
mountPath: /tmp/storage
- documentIndex: *StatefulSetDoc
equal:
path: spec.template.spec.containers[1].volumeMounts[1]
value:
name: storage
mountPath: /tmp/secondMountPoint

View file

@ -4,38 +4,14 @@ suite: persistence volumeclaimtemplates
templates:
- common.yaml
tests:
- it: volumeClaimTemplates should pass
- it: default should pass
set:
controllers.main:
type: statefulset
statefulset:
volumeClaimTemplates:
- name: "storage"
accessMode: "ReadWriteOnce"
size: "10Gi"
storageClass: "storage"
labels:
test: "label"
annotations:
test: "annotation"
asserts:
- documentIndex: 0
- documentIndex: &StatefulSetDoc 0
isKind:
of: StatefulSet
- documentIndex: 0
equal:
path: spec.volumeClaimTemplates[0]
value:
metadata:
name: storage
labels:
test: "label"
annotations:
test: "annotation"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: storage
- documentIndex: *StatefulSetDoc
notExists:
path: spec.volumeClaimTemplates

View file

@ -10,6 +10,7 @@ tests:
init1:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: latest
env:
int: 1
float: 1.5
@ -66,10 +67,12 @@ tests:
order: 2
image:
repository: ghcr.io/mendhak/http-https-echo
tag: latest
init2:
order: 1
image:
repository: ghcr.io/mendhak/http-https-echo
tag: latest
asserts:
- documentIndex: &DeploymentDocument 0
isKind: