feat(common)!: Release v3.0.0-beta1 (#278)

This commit is contained in:
Bernd Schorgers 2024-03-07 19:53:41 +01:00 committed by GitHub
parent deafcf75a1
commit b78483b0b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
88 changed files with 3697 additions and 1209 deletions

View file

@ -1,6 +1,6 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod sidecar containers
suite: pod with multiple containers
templates:
- common.yaml
tests:
@ -9,6 +9,7 @@ tests:
controllers.main.containers:
additional1:
nameOverride: template-test
dependsOn: main
image:
repository: test
tag: test
@ -25,6 +26,7 @@ tests:
set:
controllers.main.containers:
additional1:
dependsOn: main
image:
repository: test
tag: test
@ -42,6 +44,7 @@ tests:
controllers.main.containers:
additional1:
nameOverride: "{{ .Release.Name }}-container"
dependsOn: main
image:
repository: test
tag: test
@ -61,6 +64,7 @@ tests:
env:
main_env: value
additional1:
dependsOn: main
image:
repository: test
tag: test

View file

@ -7,6 +7,10 @@ tests:
- it: with default order
set:
controllers.main.containers:
main:
image:
repository: test
tag: test
additional1:
image:
repository: test
@ -26,60 +30,15 @@ tests:
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[0].name
value: main
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].name
value: additional1
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[2].name
value: additional2
# TODO: Remove this test case after "order" removal in v3
- it: with custom order
set:
controllers.main.containers:
main:
order: 2
additional1:
order: 3
image:
repository: test
tag: test
additional2:
order: 1
image:
repository: test
tag: test
additional3:
image:
repository: test
tag: test
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
lengthEqual:
path: spec.template.spec.containers
count: 4
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[0].name
value: additional2
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].name
value: main
value: additional2
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[2].name
value: additional1
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[3].name
value: additional3
value: main
- it: with dependsOn
set:
@ -123,48 +82,3 @@ tests:
equal:
path: spec.template.spec.containers[3].name
value: additional2
# TODO: Remove this test case after "order" removal in v3
- it: with both order and dependsOn
set:
controllers.main.containers:
additional1:
dependsOn: additional3
image:
repository: test
tag: test
additional2:
dependsOn: additional3
order: 1
image:
repository: test
tag: test
additional3:
dependsOn: main
image:
repository: test
tag: test
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
lengthEqual:
path: spec.template.spec.containers
count: 4
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[0].name
value: main
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].name
value: additional3
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[2].name
value: additional1
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[3].name
value: additional2

View file

@ -0,0 +1,39 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod enableServiceLinks
templates:
- common.yaml
tests:
- it: default should pass
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.enableServiceLinks
value: false
- it: enabled in defaultPodOptions should pass
set:
defaultPodOptions.enableServiceLinks: true
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.enableServiceLinks
value: true
- it: enabled in pod options should pass
set:
controllers.main.pod.enableServiceLinks: true
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.enableServiceLinks
value: true

View file

@ -14,6 +14,17 @@ tests:
path: spec.replicas
value: 1
- it: nil should pass
set:
controllers.main.replicas: null
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
path: spec.replicas
- it: custom replicas should pass
set:
controllers.main.replicas: 3

View file

@ -52,6 +52,7 @@ tests:
enabled: false
image:
repository: ghcr.io/mendhak/http-https-echo
tag: test
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
@ -60,37 +61,6 @@ tests:
notExists:
path: spec.template.spec.initContainers
# TODO: Remove this test case after "order" removal in v3
- it: custom order should pass
set:
controllers.main.initContainers:
init1:
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:
of: Deployment
- documentIndex: *DeploymentDocument
lengthEqual:
path: spec.template.spec.initContainers
count: 2
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.initContainers[0].name
value: init2
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.initContainers[1].name
value: init1
- it: with dependsOn
set:
controllers.main.initContainers:
@ -119,3 +89,28 @@ tests:
equal:
path: spec.template.spec.initContainers[1].name
value: init1
- it: with custom restartPolicy (sidecar)
set:
controllers.main.initContainers:
test:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: latest
restartPolicy: Always
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
lengthEqual:
path: spec.template.spec.initContainers
count: 1
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.initContainers[0].name
value: test
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.initContainers[0].restartPolicy
value: Always