feat(common): Release common 4.0.0 (#398)

Co-authored-by: lab-assistant[bot] <180935599+lab-assistant[bot]@users.noreply.github.com>
This commit is contained in:
Bernd Schorgers 2025-05-16 08:40:39 +02:00
parent 1e210f43e3
commit a01a89cb13
No known key found for this signature in database
327 changed files with 11181 additions and 7330 deletions

View file

@ -1,15 +1,15 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod affinity
suite: pod - fields - affinity
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: affinity is not present by default
documentSelector: &DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME
value: release-name
asserts:
- notExists:
path: spec.template.spec.affinity
@ -27,7 +27,9 @@ tests:
values:
- antarctica-east1
- antarctica-west1
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.affinity
@ -68,7 +70,9 @@ tests:
values:
- asia-east1
- asia-west1
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.affinity
@ -96,9 +100,11 @@ tests:
- key: app
operator: In
values:
- "{{ .Release.Name }}"
- "{{ .Release.Name | lower }}"
topologyKey: kubernetes.io/hostname
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.affinity
@ -110,5 +116,5 @@ tests:
- key: app
operator: In
values:
- RELEASE-NAME
- release-name
topologyKey: kubernetes.io/hostname

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 with multiple containers
suite: pod - fields - containers - multiple
templates:
- common.yaml
values:
@ -15,12 +15,11 @@ tests:
image:
repository: test
tag: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[1].name
value: template-test
@ -32,12 +31,11 @@ tests:
image:
repository: test
tag: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[1].name
value: additional1
@ -45,19 +43,18 @@ tests:
set:
controllers.main.containers:
additional1:
nameOverride: "{{ .Release.Name }}-container"
nameOverride: "{{ .Release.Name | lower }}-container"
dependsOn: main
image:
repository: test
tag: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[1].name
value: RELEASE-NAME-container
value: release-name-container
- it: with custom env vars dict should pass
set:
@ -74,38 +71,33 @@ tests:
int: 1
float: 1.5
string: value_of_env
template: "{{ .Release.Name }}-admin"
template: "{{ .Release.Name | lower }}-admin"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.containers[0].env[0]
value:
name: main_env
value: "value"
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.containers[1].env[0]
value:
name: float
value: "1.5"
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.containers[1].env[1]
value:
name: int
value: "1"
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.containers[1].env[2]
value:
name: string
value: value_of_env
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.containers[1].env[3]
value:
name: template
value: RELEASE-NAME-admin
value: release-name-admin

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 - fields - containers - order
templates:
- common.yaml
values:
@ -21,24 +21,20 @@ tests:
image:
repository: test
tag: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
lengthEqual:
- lengthEqual:
path: spec.template.spec.containers
count: 3
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.containers[0].name
value: additional1
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.containers[1].name
value: additional2
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.containers[2].name
value: main
@ -60,27 +56,22 @@ tests:
image:
repository: test
tag: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
lengthEqual:
- lengthEqual:
path: spec.template.spec.containers
count: 4
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.containers[0].name
value: main
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.containers[1].name
value: additional3
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.containers[2].name
value: additional1
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.containers[3].name
value: additional2

View file

@ -1,18 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod dnsConfig
suite: pod - fields - dnsConfig
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
- notExists:
path: spec.template.spec.dnsConfig
- it: defaultPodOption should pass
@ -22,12 +21,11 @@ tests:
options:
- name: ndots
value: "1"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.dnsConfig
value:
options:
@ -48,12 +46,11 @@ tests:
options:
- name: ndots
value: "5"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.dnsConfig
value:
options:

View file

@ -1,18 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod dnsPolicy
suite: pod - fields - dnsPolicy
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.dnsPolicy
value: ClusterFirst
@ -20,12 +19,11 @@ tests:
set:
defaultPodOptions:
hostNetwork: true
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.dnsPolicy
value: ClusterFirstWithHostNet
@ -33,11 +31,10 @@ tests:
set:
defaultPodOptions:
dnsPolicy: None
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.dnsPolicy
value: None

View file

@ -1,41 +1,38 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod enableServiceLinks
suite: pod - fields - enableServiceLinks
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.enableServiceLinks
value: false
- it: enabled in defaultPodOptions should pass
set:
defaultPodOptions.enableServiceLinks: true
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.enableServiceLinks
value: true
- it: enabled in pod options should pass
set:
controllers.main.pod.enableServiceLinks: true
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.enableServiceLinks
value: true

View file

@ -1,18 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod hostAliases
suite: pod - fields - hostAliases
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
- notExists:
path: spec.template.spec.hostAliases
- it: defaultPodOption should pass
@ -23,12 +22,11 @@ tests:
hostnames:
- "example.com"
- "www.example.com"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.hostAliases
value:
- ip: "192.168.1.100"
@ -51,12 +49,11 @@ tests:
- ip: "127.0.0.1"
hostnames:
- "localhost"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.hostAliases
value:
- ip: "127.0.0.1"

View file

@ -1,18 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod security
suite: pod - fields - hostIPC
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.hostIPC
value: false
@ -20,12 +19,11 @@ tests:
set:
defaultPodOptions:
hostIPC: false
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.hostIPC
value: false
@ -33,10 +31,10 @@ tests:
set:
defaultPodOptions:
hostIPC: true
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.hostIPC

View file

@ -1,18 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod hostNetwork
suite: pod - fields - hostNetwork
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.hostNetwork
value: false
@ -20,12 +19,11 @@ tests:
set:
defaultPodOptions:
hostNetwork: false
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.hostNetwork
value: false
@ -33,10 +31,10 @@ tests:
set:
defaultPodOptions:
hostNetwork: true
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.hostNetwork

View file

@ -1,18 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod security
suite: pod - fields - hostPID
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.hostPID
value: false
@ -20,12 +19,11 @@ tests:
set:
defaultPodOptions:
hostPID: false
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.hostPID
value: false
@ -33,11 +31,10 @@ tests:
set:
defaultPodOptions:
hostPID: true
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.hostPID
value: true

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 security
suite: pod - fields - hostUsers
templates:
- common.yaml
values:
@ -13,9 +13,9 @@ tests:
capabilities:
majorVersion: 1
minorVersion: 28
documentSelector: &DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME
value: release-name
asserts:
- notExists:
path: spec.template.spec.hostUsers
@ -27,13 +27,17 @@ tests:
set:
defaultPodOptions:
hostUsers: false
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- notExists:
path: spec.template.spec.hostUsers
- it: should not be present by default for kubernetes >= 1.29
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- notExists:
path: spec.template.spec.hostUsers
@ -42,7 +46,9 @@ tests:
set:
defaultPodOptions:
hostUsers: false
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.hostUsers
@ -52,7 +58,9 @@ tests:
set:
defaultPodOptions:
hostUsers: true
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.hostUsers

View file

@ -1,18 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod imagePullSecrets
suite: pod - fields - imagePullSecrets
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
- notExists:
path: spec.template.spec.imagePullSecrets
- it: defaultPodOption should pass
@ -20,12 +19,11 @@ tests:
defaultPodOptions:
imagePullSecrets:
- name: my-pull-secret
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.imagePullSecrets
value:
- name: my-pull-secret
@ -40,12 +38,11 @@ tests:
pod:
imagePullSecrets:
- name: my-other-secret
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.imagePullSecrets
value:
- name: my-other-secret

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 initContainers
suite: pod - fields - initContainers
templates:
- common.yaml
values:
@ -17,35 +17,31 @@ tests:
int: 1
float: 1.5
string: value_of_env
template: "{{ .Release.Name }}-admin"
template: "{{ .Release.Name | lower }}-admin"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.initContainers[0].env[0]
value:
name: float
value: "1.5"
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.initContainers[0].env[1]
value:
name: int
value: "1"
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.initContainers[0].env[2]
value:
name: string
value: value_of_env
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.initContainers[0].env[3]
value:
name: template
value: RELEASE-NAME-admin
value: release-name-admin
- it: disabled should pass
set:
@ -55,12 +51,11 @@ tests:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
notExists:
- notExists:
path: spec.template.spec.initContainers
- it: with dependsOn
@ -75,20 +70,17 @@ tests:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: latest
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
lengthEqual:
- lengthEqual:
path: spec.template.spec.initContainers
count: 2
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.initContainers[0].name
value: init2
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.initContainers[1].name
value: init1
@ -100,19 +92,16 @@ tests:
repository: ghcr.io/mendhak/http-https-echo
tag: latest
restartPolicy: Always
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
lengthEqual:
- lengthEqual:
path: spec.template.spec.initContainers
count: 1
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.initContainers[0].name
value: test
- documentIndex: *DeploymentDocument
equal:
- equal:
path: spec.template.spec.initContainers[0].restartPolicy
value: Always

View file

@ -1,18 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod nodeSelector
suite: pod - fields - nodeSelector
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
- notExists:
path: spec.template.spec.nodeSelector
- it: defaultPodOption should pass
@ -20,12 +19,11 @@ tests:
defaultPodOptions:
nodeSelector:
disktype: ssd
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.nodeSelector
value:
disktype: ssd
@ -40,10 +38,10 @@ tests:
pod:
nodeSelector:
disktype: hdd
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.nodeSelector

View file

@ -1,28 +1,27 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod replicas
suite: pod - fields - replicas
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.replicas
value: 1
- it: nil should pass
set:
controllers.main.replicas: null
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
path: spec.replicas
@ -30,10 +29,10 @@ tests:
- it: custom replicas should pass
set:
controllers.main.replicas: 3
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.replicas

View file

@ -0,0 +1,110 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod - fields - resources
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
capabilities:
majorVersion: 1
minorVersion: 32
tests:
- it: should not be present by default for kubernetes < 1.32
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
capabilities:
majorVersion: 1
minorVersion: 31
asserts:
- notExists:
path: spec.resources
- it: should not be present even if specified for kubernetes < 1.32
capabilities:
majorVersion: 1
minorVersion: 31
set:
controllers:
main:
pod:
resources:
limits:
memory: 128Mi
asserts:
- notExists:
path: spec.resources
- it: should not be present by default for kubernetes >= 1.32
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- notExists:
path: spec.resources
- it: defaultPodOption should pass
set:
defaultPodOptions:
resources:
limits:
cpu: 100m
memory: 128Mi
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.resources
value:
limits:
cpu: 100m
memory: 128Mi
- it: defaultPodOption with pod override should overwrite by default
set:
defaultPodOptions:
resources:
limits:
cpu: 100m
memory: 128Mi
controllers:
main:
pod:
resources:
limits:
memory: 256Mi
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.resources
value:
limits:
memory: 256Mi
- it: defaultPodOption with pod override can be merged
set:
defaultPodOptionsStrategy: merge
defaultPodOptions:
resources:
limits:
cpu: 100m
memory: 128Mi
controllers:
main:
pod:
resources:
limits:
memory: 256Mi
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.resources
value:
limits:
cpu: 100m
memory: 256Mi

View file

@ -1,18 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod securityContext
suite: pod - fields - securityContext
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
- notExists:
path: spec.template.spec.securityContext
- it: defaultPodOption should pass
@ -23,12 +22,11 @@ tests:
runAsGroup: 1000
fsGroup: 1000
fsGroupChangePolicy: OnRootMismatch
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.securityContext
value:
runAsUser: 1000
@ -52,12 +50,11 @@ tests:
runAsGroup: 568
fsGroup: 568
fsGroupChangePolicy: OnRootMismatch
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.securityContext
value:
runAsUser: 568

View file

@ -1,174 +1,56 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod serviceAccount
suite: pod - fields - serviceAccount
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- hasDocuments:
count: 1
- documentIndex: &deploymentDocument 0
isKind:
of: Deployment
- documentIndex: *deploymentDocument
equal:
- equal:
path: spec.template.spec.serviceAccountName
value: default
- it: default with flag should pass
set:
enforceServiceAccountCreation: true
asserts:
- hasDocuments:
count: 1
- documentIndex: &deploymentDocument 0
isKind:
of: Deployment
- documentIndex: *deploymentDocument
equal:
path: spec.template.spec.serviceAccountName
value: default
- it: with create, without name should pass
set:
serviceAccount:
create: true
asserts:
- hasDocuments:
count: 3
- documentIndex: &serviceAccountDocument 0
isKind:
of: ServiceAccount
- documentIndex: &deploymentDocument 1
isKind:
of: Deployment
- documentIndex: *deploymentDocument
equal:
path: spec.template.spec.serviceAccountName
value: RELEASE-NAME
- it: with create, with name should pass
set:
serviceAccount:
create: true
name: mySA
asserts:
- hasDocuments:
count: 3
- documentIndex: &serviceAccountDocument 0
isKind:
of: ServiceAccount
- documentIndex: &deploymentDocument 1
isKind:
of: Deployment
- documentIndex: *deploymentDocument
equal:
path: spec.template.spec.serviceAccountName
value: mySA
- it: without create, with name should pass
set:
serviceAccount:
create: false
name: &serviceAccountName mySA
asserts:
- hasDocuments:
count: 1
- documentIndex: &deploymentDocument 0
isKind:
of: Deployment
- documentIndex: *deploymentDocument
equal:
path: spec.template.spec.serviceAccountName
value: *serviceAccountName
- it: without create, with name, with flag should pass
set:
enforceServiceAccountCreation: true
serviceAccount:
create: false
name: &serviceAccountName mySA
asserts:
- hasDocuments:
count: 1
- documentIndex: &deploymentDocument 0
isKind:
of: Deployment
- documentIndex: *deploymentDocument
equal:
path: spec.template.spec.serviceAccountName
value: default
- it: with extraServiceAccounts default should pass
set:
serviceAccount:
create: false
name: &serviceAccountName mySA
extraServiceAccounts:
mySA2:
create: false
mySA3:
create: true
asserts:
- hasDocuments:
count: 3
- documentIndex: &deploymentDocument 1
isKind:
of: Deployment
- documentIndex: *deploymentDocument
equal:
path: spec.template.spec.serviceAccountName
value: *serviceAccountName
- it: with extraServiceAccounts identifier should pass
- it: with serviceAccount identifier should pass
set:
controllers:
main:
serviceAccount:
identifier: mySA3
serviceAccount:
create: false
name: mySA
extraServiceAccounts:
mySA2:
create: false
mySA3:
create: true
mySA3: {}
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- hasDocuments:
count: 3
- documentIndex: &deploymentDocument 1
isKind:
of: Deployment
- documentIndex: *deploymentDocument
equal:
- equal:
path: spec.template.spec.serviceAccountName
value: RELEASE-NAME-mySA3
value: release-name
- it: with extraServiceAccounts name should pass
- it: with non-existing serviceAccount identifier fail
set:
controllers:
main:
serviceAccount:
name: arbitrary-SA
serviceAccount:
create: false
name: mySA
extraServiceAccounts:
mySA2:
create: false
mySA3:
create: true
identifier: mySA3
asserts:
- hasDocuments:
count: 3
- documentIndex: &deploymentDocument 1
isKind:
of: Deployment
- documentIndex: *deploymentDocument
equal:
- failedTemplate:
errorMessage: "No enabled ServiceAccount found with this identifier. (controller: 'main', identifier: 'mySA3')"
- it: with serviceAccount name should pass
set:
controllers:
main:
serviceAccount:
name: mySA3
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.serviceAccountName
value: arbitrary-SA
value: mySA3

View file

@ -1,15 +1,15 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod security
suite: pod - fields - shareProcessNamespace
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: shareProcessNamespace should not be present by default
documentSelector: &DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME
value: release-name
asserts:
- notExists:
path: spec.template.spec.shareProcessNamespace
@ -18,7 +18,9 @@ tests:
set:
defaultPodOptions:
shareProcessNamespace: false
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.shareProcessNamespace
@ -28,7 +30,9 @@ tests:
set:
defaultPodOptions:
shareProcessNamespace: true
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.shareProcessNamespace

View file

@ -1,18 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod tolerations
suite: pod - fields - tolerations
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
- notExists:
path: spec.template.spec.tolerations
- it: defaultPodOption should pass
@ -23,12 +22,11 @@ tests:
operator: "Equal"
value: "value1"
effect: "NoSchedule"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.tolerations
value:
- key: "key1"
@ -52,12 +50,11 @@ tests:
operator: "Equal"
value: "value1"
effect: "NoSchedule"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.tolerations
value:
- key: "master"

View file

@ -1,16 +1,16 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod topologySpreadConstraints
suite: pod - fields - topologySpreadConstraints
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
path: spec.template.spec.topologySpreadConstraints
@ -25,12 +25,11 @@ tests:
labelSelector:
matchLabels:
app: foo
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.topologySpreadConstraints
value:
- maxSkew: 1
@ -60,12 +59,11 @@ tests:
labelSelector:
matchLabels:
app: foo
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.topologySpreadConstraints
value:
- maxSkew: 2

View file

@ -0,0 +1,65 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod - fields - volumes (configMap)
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
configMaps:
mySettings:
suffix: mySettings
data:
test: testvalue
persistence:
configmap:
type: configMap
tests:
- it: configmap persistence type should pass
set:
persistence:
configmap:
name: mySettings
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
equal:
path: spec.template.spec.volumes[0]
value:
name: configmap
configMap:
name: mySettings
- it: configmap persistence type with name template should pass
set:
persistence:
configmap:
name: '{{ include "bjw-s.common.lib.chart.names.fullname" $ | lower }}-config'
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: configmap
configMap:
name: release-name-config
- it: configmap persistence type with identifier reference should pass
set:
persistence:
configmap:
identifier: mySettings
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: configmap
configMap:
name: release-name-mysettings

View file

@ -0,0 +1,33 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod - fields - volumes (custom)
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: custom persistence type should pass
set:
persistence:
custom-mount:
enabled: true
type: custom
volumeSpec:
downwardAPI:
items:
- path: "labels"
fieldRef:
fieldPath: metadata.labels
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: custom-mount
downwardAPI:
items:
- fieldRef:
fieldPath: metadata.labels
path: labels

View file

@ -0,0 +1,56 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod - fields - volumes (emptyDir)
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
persistence:
config:
type: emptyDir
tests:
- it: default emptyDir should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: config
emptyDir: {}
- it: emptyDir with medium should pass
set:
persistence:
config:
medium: memory
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: config
emptyDir:
medium: memory
- it: emptyDir with medium and sizeLimit should pass
set:
persistence:
config:
medium: memory
sizeLimit: 1Gi
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: config
emptyDir:
medium: memory
sizeLimit: 1Gi

View file

@ -0,0 +1,41 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod - fields - volumes (hostPath)
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
persistence:
hostpathmounts:
type: hostPath
hostPath: "/tmp1"
tests:
- it: hostPath should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: hostpathmounts
hostPath:
path: /tmp1
- it: hostPath with type should pass
set:
persistence:
hostpathmounts:
hostPathType: "Directory"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: hostpathmounts
hostPath:
path: /tmp1
type: Directory

View file

@ -0,0 +1,26 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod - fields - volumes (nfs)
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: nfs persistence type should pass
set:
persistence:
nfs:
type: nfs
server: 10.10.0.8
path: /tank/nas/library
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: nfs
nfs:
path: /tank/nas/library
server: 10.10.0.8

View file

@ -0,0 +1,75 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod - fields - volumes (pvc)
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
set:
persistence:
config:
accessMode: ReadWriteOnce
size: 1Gi
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: config
persistentVolumeClaim:
claimName: release-name
- it: with existingClaim should pass
set:
persistence:
existingClaim:
existingClaim: myClaim
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: existingClaim
persistentVolumeClaim:
claimName: myClaim
- it: disabled suffix should pass
set:
persistence:
claimWithoutSuffix:
accessMode: ReadWriteMany
size: 1G
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: claimWithoutSuffix
persistentVolumeClaim:
claimName: release-name
- it: custom suffix should pass
set:
persistence:
claimWithNameOverride:
suffix: suffix
accessMode: ReadWriteMany
size: 1G
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: claimWithNameOverride
persistentVolumeClaim:
claimName: release-name-suffix

View file

@ -0,0 +1,63 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod - fields - volumes (secret)
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
secrets:
mySettings:
stringData:
test: testvalue
persistence:
secret:
type: secret
tests:
- it: secret persistence type should pass
set:
persistence:
secret:
name: mySettings
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: secret
secret:
secretName: mySettings
- it: secret persistence type with name template should pass
set:
persistence:
secret:
name: "{{ .Release.Name | lower }}-config"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: secret
secret:
secretName: release-name-config
- it: secret persistence type with identifier reference should pass
set:
persistence:
secret:
identifier: mySettings
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes[0]
value:
name: secret
secret:
secretName: release-name

View file

@ -0,0 +1,106 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod - fields - volumes
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: no persistence should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- notExists:
path: spec.template.spec.volumes
- it: default should pass
set:
persistence:
config:
accessMode: ReadWriteOnce
size: 1Gi
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.volumes
value:
- name: config
persistentVolumeClaim:
claimName: release-name
- it: advanced mount config should pass
set:
controllers:
main:
containers:
second-container:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
second:
containers:
first-container:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
persistence:
config:
existingClaim: test
advancedMounts:
main:
main:
- path: /config
readOnly: false
data:
type: configMap
name: myConfigMap
globalMounts:
- path: /globalTest
advancedMounts:
main:
main:
- path: /data/config.yaml
readOnly: false
subPath: config.yaml
second-container:
- path: /appdata/config
readOnly: true
second:
first-container:
- path: /second-pod/config.yaml
readOnly: false
subPath: config.yaml
no-mounts:
existingClaim: test
asserts:
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name-main
equal:
path: spec.template.spec.volumes
value:
- name: config
persistentVolumeClaim:
claimName: test
- configMap:
name: myConfigMap
name: data
- name: no-mounts
persistentVolumeClaim:
claimName: test
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name-second
equal:
path: spec.template.spec.volumes
value:
- configMap:
name: myConfigMap
name: data
- name: no-mounts
persistentVolumeClaim:
claimName: test

View file

@ -1,25 +1,26 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: "pod metadata: annotations"
suite: "pod - metadata - annotations"
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default pod annotations
documentSelector: &DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME
value: release-name
asserts:
- notExists:
path: spec.template.metadata.annotations
- it: pod annotations from defaultPodOptions should be included
set:
defaultPodOptions:
annotations:
defaultPodOptionsAnnotation: test
documentSelector: *DeploymentSelector
defaultPodOptions.annotations:
defaultPodOptionsAnnotation: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- isSubset:
path: spec.template.metadata.annotations
@ -28,12 +29,11 @@ tests:
- it: pod annotations from pod options should be included
set:
controllers:
main:
pod:
annotations:
podOptionsAnnotation: test
documentSelector: *DeploymentSelector
controllers.main.pod.annotations:
podOptionsAnnotation: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- isSubset:
path: spec.template.metadata.annotations
@ -42,10 +42,11 @@ tests:
- it: pod annotations from global annotations should not be included by default
set:
global:
annotations:
globalAnnotation: test
documentSelector: *DeploymentSelector
global.annotations:
globalAnnotation: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- isNotSubset:
path: spec.template.metadata.annotations
@ -58,9 +59,102 @@ tests:
propagateGlobalMetadataToPods: true
annotations:
globalAnnotation: test
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- isSubset:
path: spec.template.metadata.annotations
content:
globalAnnotation: test
- it: configMap checksum should be included in pod annotations
set:
configMaps:
config:
enabled: true
data:
test: value 1
test_default_enabled:
data:
test: value 1
test_not_in_checksum:
includeInChecksum: false
data:
test: value 1
test_disabled:
enabled: false
data:
test: value 1
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.metadata.annotations
value:
checksum/configMaps: 66d23d7a53c4e2a523ba85a969696b4ebb78ec5d79ab9c12c210c1569f48511b
- it: configMap checksum from folder should be included in pod annotations
set:
configMaps:
config:
enabled: true
data:
test: value 1
test_default_enabled:
data:
test: value 1
test_not_in_checksum:
includeInChecksum: false
data:
test: value 1
test_disabled:
enabled: false
data:
test: value 1
configMapsFromFolder:
enabled: true
basePath: ci/configMapsFolder
configMapsOverrides:
test_2:
fileAttributeOverrides:
helm.jpg:
binary: true
test_2.yaml:
escaped: true
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.metadata.annotations
value:
checksum/configMaps: e83a24569d0b4f2ccc44aec36d4e9a1c44a29bcc92eefdffe14fb1ce81dff054
- it: secret checksum should be included in pod annotations
set:
secrets:
secret_1:
stringData:
test: value 1
secret_2: # default enabled
stringData:
test_1: value 1
test_2: value 2
test_not_in_checksum:
includeInChecksum: false
stringData:
test: value 1
test_disabled:
enabled: false
stringData:
test: value 1
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.metadata.annotations
value:
checksum/secrets: cd4e5076088172611ca1c43c659a275232d9eeb887acc20575ac141038b9aacb

View file

@ -1,29 +1,30 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: "pod metadata: labels"
suite: "pod - metadata - labels"
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default pod labels
documentSelector: &DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME
value: release-name
asserts:
- equal:
path: spec.template.metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME
- it: pod labels from defaultPodOptions should be included
set:
defaultPodOptions:
labels:
defaultPodOptionsLabel: test
documentSelector: *DeploymentSelector
defaultPodOptions.labels:
defaultPodOptionsLabel: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- isSubset:
path: spec.template.metadata.labels
@ -32,12 +33,12 @@ tests:
- it: pod labels from pod options should be included
set:
controllers:
main:
pod:
labels:
podOptionsLabel: test
documentSelector: *DeploymentSelector
controllers.main.pod:
labels:
podOptionsLabel: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- isSubset:
path: spec.template.metadata.labels
@ -46,10 +47,11 @@ tests:
- it: pod labels from global labels should not be included by default
set:
global:
labels:
globalLabel: test
documentSelector: *DeploymentSelector
global.labels:
globalLabel: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- isNotSubset:
path: spec.template.metadata.labels
@ -62,7 +64,9 @@ tests:
propagateGlobalMetadataToPods: true
labels:
globalLabel: test
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- isSubset:
path: spec.template.metadata.labels