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,5 +1,5 @@
serviceAccount:
create: true
default: {}
rbac:
roles:

View file

@ -1,6 +1,6 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: Chart validations
suite: chart - validations
templates:
- common.yaml
values:

View file

@ -0,0 +1,117 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: configmap - metadata - annotations
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: no annotations are set by default
set:
configMaps:
config:
data:
test: test
documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name
asserts:
- notExists:
path: metadata.annotations
- it: custom annotations
set:
configMaps:
config:
data:
test: test
annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
test_annotation: test
- it: custom annotations mixed with global annotations
set:
global.annotations:
global_annotation: test
configMaps:
config:
data:
test: test
annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- it: default metadata from folder should pass
set:
configMaps:
config:
data:
test: test
configMapsFromFolder:
enabled: true
basePath: ci/configMapsFolder
configMapsOverrides:
test_2:
fileAttributeOverrides:
helm.jpg:
binary: true
test_2.yaml:
escaped: true
asserts:
- documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name-config
notExists:
path: metadata.annotations
- documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name-test_1
notExists:
path: metadata.annotations
- documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name-test_2
notExists:
path: metadata.annotations
- it: custom metadata from folder should pass
set:
configMaps:
config:
data:
test: test
configMapsFromFolder:
enabled: true
basePath: ci/configMapsFolder
configMapsOverrides:
test_2:
annotations:
test: test_annotation
fileAttributeOverrides:
helm.jpg:
binary: true
test_2.yaml:
escaped: true
asserts:
- documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name-test_2
equal:
path: metadata.annotations
value:
test: test_annotation

View file

@ -1,28 +1,22 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: configmap metadata
suite: configmap - metadata - labels
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default metadata should pass
- it: default labels
set:
configMaps:
config:
data:
test: test
documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name
asserts:
- hasDocuments:
count: 2
- documentIndex: &ConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *ConfigmapDocument
notExists:
path: metadata.annotations
- documentIndex: *ConfigmapDocument
equal:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
@ -30,29 +24,19 @@ tests:
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass
- it: custom labels
set:
configMaps:
config:
data:
test: test
annotations:
test_annotation: test
labels:
test_label: test
documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name
asserts:
- hasDocuments:
count: 2
- documentIndex: &ConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *ConfigmapDocument
equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *ConfigmapDocument
equal:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
@ -61,35 +45,21 @@ tests:
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom metadata with global metadata should pass
- it: custom labels mixed with global labels
set:
global:
labels:
global_label: test
annotations:
global_annotation: test
global.labels:
global_label: test
configMaps:
config:
data:
test: test
annotations:
test_annotation: test
labels:
test_label: test
documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name
asserts:
- hasDocuments:
count: 2
- documentIndex: &ConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *ConfigmapDocument
equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- documentIndex: *ConfigmapDocument
equal:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
@ -99,19 +69,6 @@ tests:
helm.sh/chart: common-test-1.0.0
test_label: test
- it: default configuration from folder with binary files should fail
set:
configMaps:
config:
data:
test: test
configMapsFromFolder:
enabled: true
basePath: ci/configMapsFolder
asserts:
- failedTemplate:
errorMessage: "There was an error loading ConfigMap: test_2. If it was automatically generated from a folder verify that files are properly flagged as `binary` or `escaped`"
- it: default metadata from folder should pass
set:
configMaps:
@ -129,15 +86,9 @@ tests:
test_2.yaml:
escaped: true
asserts:
- hasDocuments:
count: 4
- documentIndex: &FirstConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *FirstConfigmapDocument
notExists:
path: metadata.annotations
- documentIndex: *FirstConfigmapDocument
- documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name-config
equal:
path: metadata.labels
value:
@ -145,13 +96,9 @@ tests:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- documentIndex: &SecondConfigmapDocument 1
isKind:
of: ConfigMap
- documentIndex: *SecondConfigmapDocument
notExists:
path: metadata.annotations
- documentIndex: *SecondConfigmapDocument
- documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name-test_1
equal:
path: metadata.labels
value:
@ -159,13 +106,9 @@ tests:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- documentIndex: &ThirdConfigmapDocument 2
isKind:
of: ConfigMap
- documentIndex: *ThirdConfigmapDocument
notExists:
path: metadata.annotations
- documentIndex: *ThirdConfigmapDocument
- documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name-test_2
equal:
path: metadata.labels
value:
@ -187,20 +130,15 @@ tests:
test_2:
labels:
test: test_label
annotations:
test: test_annotation
fileAttributeOverrides:
helm.jpg:
binary: true
test_2.yaml:
escaped: true
asserts:
- hasDocuments:
count: 4
- documentIndex: &FirstConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *FirstConfigmapDocument
- documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name-config
equal:
path: metadata.labels
value:
@ -208,10 +146,9 @@ tests:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- documentIndex: &SecondConfigmapDocument 1
isKind:
of: ConfigMap
- documentIndex: *SecondConfigmapDocument
- documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name-test_1
equal:
path: metadata.labels
value:
@ -219,10 +156,9 @@ tests:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- documentIndex: &ThirdConfigmapDocument 2
isKind:
of: ConfigMap
- documentIndex: *ThirdConfigmapDocument
- documentSelector:
path: $[?(@.kind == "ConfigMap")].metadata.name
value: release-name-test_2
equal:
path: metadata.labels
value:
@ -231,8 +167,3 @@ tests:
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test: test_label
- documentIndex: *ThirdConfigmapDocument
equal:
path: metadata.annotations
value:
test: test_annotation

View file

@ -0,0 +1,183 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: configmap - metadata - name
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
configMaps.main:
data:
test: test
tests:
- it: name defaults to chart fullName
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: release-name
any: true
- it: forceRename
set:
configMaps.main.forceRename: forceRename
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: forcerename
any: true
- it: forceRename with template
set:
configMaps.main.forceRename: "{{ .Chart.Name }}"
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: common-test
any: true
- it: prefix
set:
configMaps.main.prefix: prefix
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: prefix-release-name
any: true
- it: prefix with template
set:
configMaps.main.prefix: "{{ .Chart.Name }}"
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: common-test-release-name
any: true
- it: suffix
set:
configMaps.main.suffix: suffix
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: release-name-suffix
any: true
- it: suffix with template
set:
configMaps.main.suffix: "{{ .Chart.Name }}"
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: release-name-common-test
any: true
- it: both prefix and suffix
set:
configMaps.main.prefix: prefix
configMaps.main.suffix: suffix
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: prefix-release-name-suffix
any: true
- it: prefix, suffix and forceRename (illegal combination)
set:
configMaps.main.forceRename: forceRename
configMaps.main.prefix: prefix
configMaps.main.suffix: suffix
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"
- it: multiple items
set:
configMaps.second:
data:
test: test
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: release-name-main
any: true
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: release-name-second
any: true
- it: multiple items with prefix
set:
configMaps.second:
prefix: prefix
data:
test: test
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: release-name-main
any: true
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: prefix-release-name-second
any: true
- it: multiple items with suffix
set:
configMaps.second:
suffix: suffix
data:
test: test
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: release-name-main
any: true
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: release-name-second-suffix
any: true
- it: multiple items with prefix and suffix
set:
configMaps.second:
prefix: prefix
suffix: suffix
data:
test: test
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: release-name-main
any: true
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: prefix-release-name-second-suffix
any: true
- it: multiple items with prefix, suffix and forceRename (illegal combination)
set:
configMaps.second:
forceRename: forceRename
prefix: prefix
suffix: suffix
data:
test: test
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"

View file

@ -1,196 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: configMap names
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
asserts:
- hasDocuments:
count: 1
- documentIndex: 0
not: true
isKind:
of: ConfigMap
- it: with disabled configMap should pass
set:
configMaps:
config:
enabled: false
data:
test: test
asserts:
- hasDocuments:
count: 1
- documentIndex: 0
not: true
isKind:
of: ConfigMap
- it: with multiple configMap should pass
set:
configMaps:
config:
data:
foo: bar
secondary:
data:
test: test
asserts:
- hasDocuments:
count: 3
- documentIndex: &FirstConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *FirstConfigmapDocument
isNotNullOrEmpty:
path: metadata.name
- documentIndex: &SecondConfigmapDocument 1
isKind:
of: ConfigMap
- documentIndex: *SecondConfigmapDocument
isNotNullOrEmpty:
path: metadata.name
- it: default name should pass
set:
configMaps:
config:
data:
test: test
asserts:
- hasDocuments:
count: 2
- documentIndex: &ConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *ConfigmapDocument
equal:
path: metadata.name
value: RELEASE-NAME-config
- it: with nameOverride should pass
set:
configMaps:
config:
data:
test: test
nameOverride: http
asserts:
- hasDocuments:
count: 2
- documentIndex: &ConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *ConfigmapDocument
equal:
path: metadata.name
value: RELEASE-NAME-http
- it: with templated nameOverride should pass
set:
configMaps:
config:
data:
test: test
nameOverride: "{{ .Release.Name }}"
asserts:
- hasDocuments:
count: 2
- documentIndex: &ConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *ConfigmapDocument
equal:
path: metadata.name
value: RELEASE-NAME
- it: with templated nameOverride and from folder should pass
set:
configMaps:
config:
data:
test: test
nameOverride: "{{ .Release.Name }}"
configMapsFromFolder:
enabled: true
basePath: ci/configMapsFolder
configMapsOverrides:
test_2:
fileAttributeOverrides:
helm.jpg:
binary: true
test_2.yaml:
escaped: true
asserts:
- hasDocuments:
count: 4
- documentIndex: &FirstConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *FirstConfigmapDocument
equal:
path: metadata.name
value: RELEASE-NAME
- documentIndex: &SecondConfigmapDocument 1
isKind:
of: ConfigMap
- documentIndex: *SecondConfigmapDocument
equal:
path: metadata.name
value: RELEASE-NAME-test_1
- documentIndex: &ThirdConfigmapDocument 2
isKind:
of: ConfigMap
- documentIndex: *ThirdConfigmapDocument
equal:
path: metadata.name
value: RELEASE-NAME-test_2
- it: with templated nameOverride and from folder with forceRename should pass
set:
configMaps:
config:
data:
test: test
nameOverride: "{{ .Release.Name }}"
configMapsFromFolder:
enabled: true
basePath: ci/configMapsFolder
configMapsOverrides:
test_1:
forceRename: &newName1 newName1
test_2:
forceRename: &newName2 newName2
fileAttributeOverrides:
helm.jpg:
binary: true
test_2.yaml:
escaped: true
asserts:
- hasDocuments:
count: 4
- documentIndex: &FirstConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *FirstConfigmapDocument
equal:
path: metadata.name
value: RELEASE-NAME
- documentIndex: &SecondConfigmapDocument 1
isKind:
of: ConfigMap
- documentIndex: *SecondConfigmapDocument
equal:
path: metadata.name
value: *newName1
- documentIndex: &ThirdConfigmapDocument 2
isKind:
of: ConfigMap
- documentIndex: *ThirdConfigmapDocument
equal:
path: metadata.name
value: *newName2

View file

@ -1,73 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: configmap Pod metadata
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default metadata should pass
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
asserts:
- documentIndex: &ControllerDoc 3
isKind:
of: Deployment
- documentIndex: *ControllerDoc
equal:
path: spec.template.metadata.annotations
value:
checksum/configMaps: 66d23d7a53c4e2a523ba85a969696b4ebb78ec5d79ab9c12c210c1569f48511b
- it: default metadata from folder should pass
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
asserts:
- documentIndex: &ControllerDoc 5
isKind:
of: Deployment
- documentIndex: *ControllerDoc
equal:
path: spec.template.metadata.annotations
value:
checksum/configMaps: e83a24569d0b4f2ccc44aec36d4e9a1c44a29bcc92eefdffe14fb1ce81dff054

View file

@ -0,0 +1,85 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: configmap - presence
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: configMap should not be rendered by default
asserts:
- not: true
containsDocument:
apiVersion: v1
kind: ConfigMap
name: release-name
any: true
- it: with disabled configMap
set:
configMaps:
config:
enabled: false
data:
test: test
asserts:
- not: true
containsDocument:
apiVersion: v1
kind: ConfigMap
name: release-name
any: true
- it: with multiple configMaps
set:
configMaps:
config:
data:
foo: bar
secondary:
data:
test: test
asserts:
- containsDocument:
apiVersion: v1
kind: ConfigMap
name: release-name-config
any: true
- containsDocument:
apiVersion: v1
kind: ConfigMap
name: release-name-secondary
any: true
- it: combined with configMapsFromFolder
set:
configMaps:
config:
data:
test: test
configMapsFromFolder:
enabled: true
basePath: ci/configMapsFolder
configMapsOverrides:
test_2:
fileAttributeOverrides:
helm.jpg:
binary: true
test_2.yaml:
escaped: true
asserts:
- containsDocument:
apiVersion: v1
kind: ConfigMap
name: release-name-config
any: true
- containsDocument:
apiVersion: v1
kind: ConfigMap
name: release-name-test_1
any: true
- containsDocument:
apiVersion: v1
kind: ConfigMap
name: release-name-test_2
any: true

View file

@ -0,0 +1,20 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: configmap - validations
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default configuration from folder with binary files should fail
set:
configMaps:
config:
data:
test: test
configMapsFromFolder:
enabled: true
basePath: ci/configMapsFolder
asserts:
- failedTemplate:
errorMessage: "There was an error loading ConfigMap: test_2. If it was automatically generated from a folder verify that files are properly flagged as `binary` or `escaped`"

View file

@ -1,29 +1,27 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container args override
suite: container - fields - args
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.containers[0].args
- it: single string should pass
set:
controllers.main.containers.main.args: sleep infinity
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].args
value:
- sleep infinity
@ -33,12 +31,11 @@ tests:
controllers.main.containers.main.args: |
echo hello
echo world
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].args
value:
- |-
@ -48,12 +45,11 @@ tests:
- it: single quoted string should pass
set:
controllers.main.containers.main.args: "sleep infinity"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].args
value:
- sleep infinity
@ -64,12 +60,11 @@ tests:
- sleep
- infinity
- "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[0].args
value:
- sleep
@ -80,12 +75,11 @@ tests:
set:
controllers.main.defaultContainerOptions:
args: value_of_args
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].args
value:
- value_of_args
@ -97,12 +91,11 @@ tests:
controllers.main.containers.main.args:
- value 1
- value 2
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].args
value:
- value 1

View file

@ -1,29 +1,27 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container command override
suite: container - fields - command
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.containers[0].command
- it: single string should pass
set:
controllers.main.containers.main.command: /bin/sh
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].command
value:
- /bin/sh
@ -33,12 +31,11 @@ tests:
controllers.main.containers.main.command: |
/bin/sh
-c
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].command
value:
- |-
@ -48,12 +45,11 @@ tests:
- it: single quoted string should pass
set:
controllers.main.containers.main.command: "/bin/sh"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].command
value:
- /bin/sh
@ -63,12 +59,11 @@ tests:
controllers.main.containers.main.command:
- /bin/sh
- "-c"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].command
value:
- /bin/sh
@ -78,12 +73,11 @@ tests:
set:
controllers.main.defaultContainerOptions:
command: value_of_command
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].command
value:
- value_of_command
@ -95,12 +89,11 @@ tests:
controllers.main.containers.main.command:
- value 1
- value 2
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].command
value:
- value 1

View file

@ -1,30 +1,28 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container env values
suite: container - fields - env
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: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
notExists:
- notExists:
path: spec.template.spec.containers[0].env
- it: KeyValue string should pass
set:
controllers.main.containers.main.env:
string: value_of_env
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[0]
value:
name: string
@ -34,12 +32,11 @@ tests:
set:
controllers.main.containers.main.env:
string: 4.2
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[0]
value:
name: string
@ -49,12 +46,11 @@ tests:
set:
controllers.main.containers.main.env:
string: 1
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[0]
value:
name: string
@ -65,12 +61,11 @@ tests:
controllers.main.containers.main.env:
- name: STATIC_ENV_FROM_LIST
value: STATIC_ENV_VALUE_FROM_LIST
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[0]
value:
name: STATIC_ENV_FROM_LIST
@ -83,12 +78,11 @@ tests:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[0]
value:
name: DYNAMIC_ENV_FROM_LIST
@ -102,12 +96,11 @@ tests:
- name: DYNAMIC_ENV_FROM_LIST
fieldRef:
fieldPath: spec.nodeName
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[0]
value:
name: DYNAMIC_ENV_FROM_LIST
@ -121,12 +114,11 @@ tests:
DYNAMIC_ENV:
fieldRef:
fieldPath: spec.nodeName
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[0]
value:
name: DYNAMIC_ENV
@ -143,18 +135,16 @@ tests:
secretKeyRef:
name: "{{ .Release.Name }}-secret"
key: "{{ .Release.Name }}-key"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[0]
value:
name: DYNAMIC_ENV
value: RELEASE-NAME-admin
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[1]
value:
name: TEMPLATE_ENV
@ -171,20 +161,18 @@ tests:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[0]
value:
name: DYNAMIC_ENV
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[1]
value:
name: STATIC_ENV
@ -207,32 +195,28 @@ tests:
dependsOn:
- DYNAMIC_ENV
- ORDERED_ENV
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[0]
value:
name: STATIC_ENV
value: "1"
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[1]
value:
name: DYNAMIC_ENV
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[2]
value:
name: ORDERED_ENV
value: "true"
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[3]
value:
name: DEPENDENT_ENV
@ -243,12 +227,11 @@ tests:
controllers.main.defaultContainerOptions:
env:
string: value_of_env
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[0]
value:
name: string
@ -261,12 +244,11 @@ tests:
string: value_of_env
controllers.main.containers.main.env:
someThingElse: value_of_env
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].env[0]
value:
name: someThingElse

View file

@ -1,18 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container envFrom values
suite: container - fields - envFrom
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: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
notExists:
- notExists:
path: spec.template.spec.containers[0].envFrom
- it: explicit envFrom should pass
@ -23,19 +22,17 @@ tests:
prefix: test
- configMapRef:
name: myCustomConfig
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].envFrom[0]
value:
secretRef:
name: myCustomSecret
prefix: test
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].envFrom[1]
value:
configMapRef:
@ -50,19 +47,17 @@ tests:
prefix: test
- configMapRef:
name: myCustomConfig
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].envFrom[0]
value:
secretRef:
name: myCustomSecret
prefix: test
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].envFrom[1]
value:
configMapRef:
@ -81,19 +76,17 @@ tests:
- secretRef:
name: myCustomSecretOverride
prefix: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].envFrom[0]
value:
secretRef:
name: myCustomSecretOverride
prefix: test
- documentIndex: *DeploymentDoc
notExists:
- notExists:
path: spec.template.spec.containers[0].envFrom[1]
- it: envFrom configmap identifier reference should pass
@ -107,23 +100,21 @@ tests:
config:
data:
test: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 1
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].envFrom[0]
value:
configMapRef:
name: RELEASE-NAME-config
name: release-name
prefix: test
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].envFrom[1]
value:
configMapRef:
name: RELEASE-NAME-config
name: release-name
- it: envFrom Secret identifier reference should pass
set:
@ -137,23 +128,21 @@ tests:
secret:
stringData:
test: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].envFrom[0]
value:
secretRef:
name: RELEASE-NAME-secret
name: release-name
prefix: test
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].envFrom[1]
value:
secretRef:
name: RELEASE-NAME-secret
name: release-name
prefix: test
- it: envFrom with templated name reference should pass
@ -165,30 +154,26 @@ tests:
- secret: "{{ .Release.Name }}-secret"
- secretRef:
name: "{{ .Release.Name }}-secret2"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].envFrom[0]
value:
configMapRef:
name: RELEASE-NAME-config
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].envFrom[1]
value:
configMapRef:
name: RELEASE-NAME-config2
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].envFrom[2]
value:
secretRef:
name: RELEASE-NAME-secret
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].envFrom[3]
value:
secretRef:

View file

@ -1,6 +1,6 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container image tag
suite: container - fields - image
templates:
- common.yaml
tests:
@ -11,12 +11,11 @@ tests:
controllers.main.containers.main.image:
repository: ghcr.io/mendhak/http-https-echo
tag: latest
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].image
value: ghcr.io/mendhak/http-https-echo:latest
@ -27,12 +26,11 @@ tests:
controllers.main.containers.main.image:
repository: ghcr.io/mendhak/http-https-echo
tag: 1.23
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].image
value: ghcr.io/mendhak/http-https-echo:1.23
@ -43,12 +41,11 @@ tests:
controllers.main.containers.main.image:
repository: ghcr.io/mendhak/http-https-echo
tag: "{{.Chart.Version}}"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].image
value: ghcr.io/mendhak/http-https-echo:1.0.0
@ -61,12 +58,11 @@ tests:
tag: 32
containers:
main: {} # needed to have at least a container enabled
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].image
value: ghcr.io/mendhak/http-https-echo:32
@ -78,11 +74,10 @@ tests:
controllers.main.containers.main.image:
repository: ghcr.io/mendhak/http-https-echo-override
tag: 33
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].image
value: ghcr.io/mendhak/http-https-echo-override:33

View file

@ -1,6 +1,6 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container name
suite: container - fields - nameOverride
templates:
- common.yaml
values:
@ -13,12 +13,11 @@ tests:
nameOverride: template-test
image:
repository: ghcr.io/mendhak/http-https-echo
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].name
value: template-test
@ -28,12 +27,11 @@ tests:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].name
value: main
@ -44,11 +42,10 @@ tests:
nameOverride: "{{ .Release.Name }}-container"
image:
repository: ghcr.io/mendhak/http-https-echo
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].name
value: RELEASE-NAME-container

View file

@ -1,18 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container ports
suite: container - fields - ports
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.containers[0].ports
- it: custom port should pass
@ -25,13 +24,11 @@ tests:
- containerPort: 8080
name: http
protocol: TCP
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].ports[0]
value:
containerPort: 8080

View file

@ -1,6 +1,6 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container probes
suite: container - fields - probes
templates:
- common.yaml
values:
@ -13,9 +13,9 @@ set:
tests:
- it: default probes
documentSelector: &DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME
value: release-name
asserts:
- equal:
path: spec.template.spec.containers[0].livenessProbe
@ -51,7 +51,9 @@ tests:
enabled: true
primary: true
port: 8080
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
@ -87,7 +89,9 @@ tests:
- it: probes with string Service port
set:
service.main.ports.http.port: "80"
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.containers[0].livenessProbe
@ -144,37 +148,37 @@ tests:
asserts:
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME-main
value: release-name-main
equal:
path: spec.template.spec.containers[0].livenessProbe.tcpSocket.port
value: 8081
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME-main
value: release-name-main
equal:
path: spec.template.spec.containers[0].readinessProbe.tcpSocket.port
value: 8081
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME-main
value: release-name-main
equal:
path: spec.template.spec.containers[0].startupProbe.tcpSocket.port
value: 8081
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME-other
value: release-name-other
equal:
path: spec.template.spec.containers[0].livenessProbe.tcpSocket.port
value: 8080
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME-other
value: release-name-other
equal:
path: spec.template.spec.containers[0].readinessProbe.tcpSocket.port
value: 8080
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME-other
value: release-name-other
equal:
path: spec.template.spec.containers[0].startupProbe.tcpSocket.port
value: 8080
@ -185,7 +189,9 @@ tests:
main:
enabled: false
controller: main
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- notExists:
path: spec.template.spec.containers[0].livenessProbe
@ -202,7 +208,9 @@ tests:
enabled: true
type: AUTO
path: /api/version
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
@ -227,7 +235,9 @@ tests:
enabled: true
type: HTTP
path: /api/version
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.containers[0].livenessProbe
@ -248,7 +258,9 @@ tests:
enabled: true
type: HTTPS
path: /api/version
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.containers[0].livenessProbe
@ -268,7 +280,9 @@ tests:
liveness:
enabled: true
type: GRPC
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.containers[0].livenessProbe
@ -287,7 +301,9 @@ tests:
enabled: true
type: GRPC
service: test
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.containers[0].livenessProbe
@ -314,7 +330,9 @@ tests:
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.containers[0].livenessProbe
@ -341,7 +359,9 @@ tests:
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.containers[0].readinessProbe
@ -368,7 +388,9 @@ tests:
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.containers[0].startupProbe
@ -387,7 +409,9 @@ tests:
liveness:
enabled: true
port: http
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
equal:
@ -406,7 +430,9 @@ tests:
readiness:
enabled: true
port: http
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.containers[0].readinessProbe
@ -424,7 +450,9 @@ tests:
startup:
enabled: true
port: http
documentSelector: *DeploymentSelector
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.containers[0].startupProbe

View file

@ -1,18 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container resources
suite: container - fields - resources
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.containers[0].resources
- it: defaultContainerOption should pass
@ -28,18 +27,16 @@ tests:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
memory: 1Gi
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.initContainers[0].resources
value:
requests:
@ -63,18 +60,16 @@ tests:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
memory: 2Gi
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.initContainers[0].resources
value:
requests:
@ -96,18 +91,16 @@ tests:
resources:
requests:
memory: 2Gi
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
memory: 1Gi
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.initContainers[0].resources
value:
requests:
@ -127,16 +120,14 @@ tests:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
memory: 1Gi
- documentIndex: 0
notExists:
- notExists:
path: spec.template.spec.initContainers[0].resources

View file

@ -1,18 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container restartPolicy
suite: container - fields - restartPolicy
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.containers[0].restartPolicy
- it: custom restartPolicy should pass
@ -20,12 +19,10 @@ tests:
controllers.main.containers:
main:
restartPolicy: Always
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[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: container securityContext
suite: container - 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.containers[0].securityContext
- it: defaultContainerOption should pass
@ -23,12 +22,11 @@ tests:
securityContext:
runAsUser: 1000
runAsGroup: 1000
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].securityContext
value:
runAsUser: 1000
@ -47,12 +45,11 @@ tests:
securityContext:
runAsUser: 568
runAsGroup: 568
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].securityContext
value:
runAsUser: 568

View file

@ -1,18 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container stdin
suite: container - fields - stdin
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.containers[0].stdin
- it: custom stdin should pass
@ -20,11 +19,10 @@ tests:
controllers.main.containers:
main:
stdin: true
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].stdin
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: container tty
suite: container - fields - tty
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.containers[0].tty
- it: custom tty should pass
@ -20,11 +19,10 @@ tests:
controllers.main.containers:
main:
tty: true
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].tty
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: container volumeMounts
suite: container - fields - volumeMounts
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:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
notExists:
- notExists:
path: spec.template.spec.containers[0].volumeMounts
- it: default should pass
@ -21,12 +20,11 @@ tests:
config:
accessMode: ReadWriteOnce
size: 1Gi
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 1
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].volumeMounts[0]
value:
name: config
@ -47,7 +45,6 @@ tests:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
persistence:
data:
type: configMap
@ -69,12 +66,10 @@ tests:
- path: /second-pod/config.yaml
readOnly: false
subPath: config.yaml
asserts:
- documentIndex: &FirstDeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *FirstDeploymentDoc
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name-main
equal:
path: spec.template.spec.containers[0].volumeMounts
value:
@ -84,7 +79,9 @@ tests:
name: data
subPath: config.yaml
mountPropagation: HostToContainer
- documentIndex: *FirstDeploymentDoc
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name-main
equal:
path: spec.template.spec.containers[1].volumeMounts
value:
@ -93,10 +90,9 @@ tests:
- mountPath: /appdata/config
name: data
readOnly: true
- documentIndex: &SecondDeploymentDoc 1
isKind:
of: Deployment
- documentIndex: *SecondDeploymentDoc
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name-second
equal:
path: spec.template.spec.containers[0].volumeMounts
value:
@ -111,12 +107,11 @@ tests:
persistence:
cache:
type: emptyDir
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].volumeMounts[0]
value:
name: cache
@ -130,12 +125,11 @@ tests:
size: 1G
globalMounts:
- path: /custom
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 1
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].volumeMounts[0]
value:
name: config
@ -149,18 +143,36 @@ tests:
globalMounts:
- path: /config
subPath: "mySubPath"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].volumeMounts[0]
value:
name: config
mountPath: /config
subPath: mySubPath
- it: mount with subPathExpr should pass
set:
persistence:
config:
existingClaim: myClaim
globalMounts:
- path: /config
subPathExpr: $(POD_NAME)
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.containers[0].volumeMounts[0]
value:
name: config
mountPath: /config
subPathExpr: $(POD_NAME)
- it: hostPath with custom mountPath should pass
set:
persistence:
@ -169,12 +181,11 @@ tests:
hostPath: /tmp
globalMounts:
- path: /data
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].volumeMounts[0]
value:
name: config
@ -188,12 +199,11 @@ tests:
hostPath: /dev
globalMounts:
- subPath: mySubPath
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
- equal:
path: spec.template.spec.containers[0].volumeMounts[0]
value:
name: config
@ -210,12 +220,11 @@ tests:
accessMode: "ReadWriteOnce"
size: "10Gi"
storageClass: "storage"
documentSelector:
path: $[?(@.kind == "StatefulSet")].metadata.name
value: release-name
asserts:
- documentIndex: &StatefulSetDoc 0
isKind:
of: StatefulSet
- documentIndex: *StatefulSetDoc
equal:
- equal:
path: spec.template.spec.containers[0].volumeMounts[0]
value:
name: storage
@ -234,18 +243,16 @@ tests:
globalMounts:
- path: /tmp/storage
- path: /tmp/secondMountPoint
documentSelector:
path: $[?(@.kind == "StatefulSet")].metadata.name
value: release-name
asserts:
- documentIndex: &StatefulSetDoc 0
isKind:
of: StatefulSet
- documentIndex: *StatefulSetDoc
equal:
- equal:
path: spec.template.spec.containers[0].volumeMounts[0]
value:
name: storage
mountPath: /tmp/storage
- documentIndex: *StatefulSetDoc
equal:
- equal:
path: spec.template.spec.containers[0].volumeMounts[1]
value:
name: storage
@ -270,21 +277,18 @@ tests:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
documentSelector:
path: $[?(@.kind == "StatefulSet")].metadata.name
value: release-name
asserts:
- documentIndex: &StatefulSetDoc 0
isKind:
of: StatefulSet
- documentIndex: *StatefulSetDoc
notExists:
- notExists:
path: spec.template.spec.containers[0].volumeMounts
- documentIndex: *StatefulSetDoc
equal:
- equal:
path: spec.template.spec.containers[1].volumeMounts[0]
value:
name: storage
mountPath: /tmp/storage
- documentIndex: *StatefulSetDoc
equal:
- equal:
path: spec.template.spec.containers[1].volumeMounts[1]
value:
name: storage

View file

@ -1,40 +1,37 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container workingDir override
suite: container - fields - workingDir
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.containers[0].workingDir
- it: string should pass
set:
controllers.main.containers.main.workingDir: /work
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].workingDir
value: /work
- it: quoted string should pass
set:
controllers.main.containers.main.workingDir: "/work"
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].workingDir
value: /work

View file

@ -1,6 +1,6 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: Container validations
suite: container - validations
templates:
- common.yaml
values:

View file

@ -1,95 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob configuration
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default cronjob configuration should pass
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: CronJob
- documentIndex: *ControllerDoc
equal:
path: spec.suspend
value: false
- documentIndex: *ControllerDoc
equal:
path: spec.schedule
value: "*/20 * * * *"
- documentIndex: *ControllerDoc
equal:
path: spec.concurrencyPolicy
value: Forbid
- documentIndex: *ControllerDoc
equal:
path: spec.successfulJobsHistoryLimit
value: 1
- documentIndex: *ControllerDoc
equal:
path: spec.failedJobsHistoryLimit
value: 1
- documentIndex: *ControllerDoc
notExists:
path: spec.jobTemplate.spec.ttlSecondsAfterFinished
- documentIndex: *ControllerDoc
equal:
path: spec.jobTemplate.spec.template.spec.restartPolicy
value: Never
- it: custom cronjob configuration should pass
set:
controllers:
main:
type: cronjob
pod:
restartPolicy: OnFailure
cronjob:
suspend: &CronJobSuspended true
schedule: &CronJobSchedule "0 3 * * *"
concurrencyPolicy: &CronJobConcurrencyPolicy "Test"
failedJobsHistory: &CronJobFailedJobsHistory 2
successfulJobsHistory: &CronJobSuccessfulJobsHistory 3
ttlSecondsAfterFinished: &ttlSecondsAfterFinished 3600
parallelism: &CronJobParallelism 3
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: CronJob
- documentIndex: *ControllerDoc
equal:
path: spec.suspend
value: *CronJobSuspended
- documentIndex: *ControllerDoc
equal:
path: spec.schedule
value: *CronJobSchedule
- documentIndex: *ControllerDoc
equal:
path: spec.concurrencyPolicy
value: *CronJobConcurrencyPolicy
- documentIndex: *ControllerDoc
equal:
path: spec.successfulJobsHistoryLimit
value: *CronJobSuccessfulJobsHistory
- documentIndex: *ControllerDoc
equal:
path: spec.failedJobsHistoryLimit
value: *CronJobFailedJobsHistory
- documentIndex: *ControllerDoc
equal:
path: spec.jobTemplate.spec.ttlSecondsAfterFinished
value: *ttlSecondsAfterFinished
- documentIndex: *ControllerDoc
equal:
path: spec.jobTemplate.spec.template.spec.restartPolicy
value: OnFailure
- documentIndex: *ControllerDoc
equal:
path: spec.jobTemplate.spec.parallelism
value: *CronJobParallelism

View file

@ -1,16 +1,16 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: controller defaultContainerOptions
suite: controller - fields - defaultContainerOptions
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.containers[0].resources
@ -25,12 +25,11 @@ tests:
controllers.main.containers.main.resources:
requests:
memory: 2Gi
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
@ -47,12 +46,11 @@ tests:
controllers.main.containers.main.resources:
requests:
memory: 2Gi
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
@ -69,12 +67,11 @@ tests:
controllers.main.containers.main.resources:
requests:
memory: 2Gi
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
@ -92,18 +89,16 @@ tests:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
memory: 1Gi
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.initContainers[0].resources
value:
requests:
@ -121,16 +116,14 @@ tests:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
memory: 1Gi
- documentIndex: 0
notExists:
- notExists:
path: spec.template.spec.initContainers[0].resources

View file

@ -1,130 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: controller revisionHistoryLimit
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
# Deployment
- it: default should pass for Deployment
set:
controllers.main.type: deployment
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.revisionHistoryLimit
value: 3
- it: custom revisionHistoryLimit should pass for Deployment
set:
controllers.main:
type: deployment
revisionHistoryLimit: 8
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.revisionHistoryLimit
value: 8
- it: explicit revisionHistoryLimit 0 should pass for Deployment
set:
controllers.main:
type: deployment
revisionHistoryLimit: 0
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.revisionHistoryLimit
value: 0
# StatefulSet
- it: default should pass for StatefulSet
set:
controllers.main.type: statefulset
asserts:
- documentIndex: 0
isKind:
of: StatefulSet
- documentIndex: 0
equal:
path: spec.revisionHistoryLimit
value: 3
- it: custom revisionHistoryLimit should pass for StatefulSet
set:
controllers.main:
type: statefulset
revisionHistoryLimit: 8
asserts:
- documentIndex: 0
isKind:
of: StatefulSet
- documentIndex: 0
equal:
path: spec.revisionHistoryLimit
value: 8
- it: explicit revisionHistoryLimit 0 should pass for StatefulSet
set:
controllers.main:
type: statefulset
revisionHistoryLimit: 0
asserts:
- documentIndex: 0
isKind:
of: StatefulSet
- documentIndex: 0
equal:
path: spec.revisionHistoryLimit
value: 0
# DaemonSet
- it: default should pass for DaemonSet
set:
controllers.main.type: daemonset
asserts:
- documentIndex: 0
isKind:
of: DaemonSet
- documentIndex: 0
equal:
path: spec.revisionHistoryLimit
value: 3
- it: custom revisionHistoryLimit should pass for DaemonSet
set:
controllers.main:
type: daemonset
revisionHistoryLimit: 8
asserts:
- documentIndex: 0
isKind:
of: DaemonSet
- documentIndex: 0
equal:
path: spec.revisionHistoryLimit
value: 8
- it: explicit revisionHistoryLimit 0 should pass for DaemonSet
set:
controllers.main:
type: daemonset
revisionHistoryLimit: 0
asserts:
- documentIndex: 0
isKind:
of: DaemonSet
- documentIndex: 0
equal:
path: spec.revisionHistoryLimit
value: 0

View file

@ -1,65 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: job configuration
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default job configuration should pass
set:
controllers:
main:
type: job
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: Job
- documentIndex: *ControllerDoc
equal:
path: spec.suspend
value: false
- documentIndex: *ControllerDoc
notExists:
path: spec.ttlSecondsAfterFinished
- documentIndex: *ControllerDoc
equal:
path: spec.template.spec.restartPolicy
value: Never
- it: custom job configuration should pass
set:
controllers:
main:
type: job
pod:
restartPolicy: OnFailure
job:
suspend: &JobSuspended true
ttlSecondsAfterFinished: &ttlSecondsAfterFinished 3600
backoffLimit: 3
parallelism: &JobParallelism 3
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: Job
- documentIndex: *ControllerDoc
equal:
path: spec.suspend
value: *JobSuspended
- documentIndex: *ControllerDoc
equal:
path: spec.ttlSecondsAfterFinished
value: *ttlSecondsAfterFinished
- documentIndex: *ControllerDoc
equal:
path: spec.template.spec.restartPolicy
value: OnFailure
- documentIndex: *ControllerDoc
equal:
path: spec.backoffLimit
value: 3
- documentIndex: *ControllerDoc
equal:
path: spec.parallelism
value: *JobParallelism

View file

@ -1,123 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: controller metadata cronjob
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.cronjob.schedule: "*/20 * * * *"
tests:
- it: default metadata should pass
set:
controllers.main.type: cronjob
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: CronJob
- documentIndex: *ControllerDoc
notExists:
path: metadata.annotations
- documentIndex: *ControllerDoc
equal:
path: metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass
set:
controllers:
main:
type: cronjob
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: CronJob
- documentIndex: *ControllerDoc
equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *ControllerDoc
equal:
path: metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom metadata with global metadata should pass
set:
global:
labels:
global_label: test
annotations:
global_annotation: test
controllers:
main:
type: cronjob
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: CronJob
- documentIndex: *ControllerDoc
equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- documentIndex: *ControllerDoc
equal:
path: metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test
- it: jobTemplate metadata should pass
set:
controllers:
main:
type: cronjob
pod:
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: CronJob
- documentIndex: *ControllerDoc
equal:
path: spec.jobTemplate.spec.template.metadata.annotations
value:
test_annotation: test
- documentIndex: *ControllerDoc
equal:
path: spec.jobTemplate.spec.template.metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME
test_label: test

View file

@ -1,92 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: controller metadata daemonset
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default metadata should pass
set:
controllers.main.type: daemonset
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: DaemonSet
- documentIndex: *ControllerDoc
notExists:
path: metadata.annotations
- documentIndex: *ControllerDoc
equal:
path: metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass
set:
controllers:
main:
type: daemonset
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: DaemonSet
- documentIndex: *ControllerDoc
equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *ControllerDoc
equal:
path: metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom metadata with global metadata should pass
set:
global:
labels:
global_label: test
annotations:
global_annotation: test
controllers:
main:
type: daemonset
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: DaemonSet
- documentIndex: *ControllerDoc
equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- documentIndex: *ControllerDoc
equal:
path: metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test

View file

@ -1,92 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: controller metadata deployment
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default metadata should pass
set:
controllers.main.type: deployment
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: Deployment
- documentIndex: *ControllerDoc
notExists:
path: metadata.annotations
- documentIndex: *ControllerDoc
equal:
path: metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass
set:
controllers:
main:
type: deployment
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: Deployment
- documentIndex: *ControllerDoc
equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *ControllerDoc
equal:
path: metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom metadata with global metadata should pass
set:
global:
labels:
global_label: test
annotations:
global_annotation: test
controllers:
main:
type: deployment
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: Deployment
- documentIndex: *ControllerDoc
equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- documentIndex: *ControllerDoc
equal:
path: metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test

View file

@ -1,120 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: controller metadata job
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default metadata should pass
set:
controllers.main.type: job
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: Job
- documentIndex: *ControllerDoc
notExists:
path: metadata.annotations
- documentIndex: *ControllerDoc
equal:
path: metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass
set:
controllers:
main:
type: job
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: Job
- documentIndex: *ControllerDoc
equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *ControllerDoc
equal:
path: metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom metadata with global metadata should pass
set:
global:
labels:
global_label: test
annotations:
global_annotation: test
controllers:
main:
type: job
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: Job
- documentIndex: *ControllerDoc
equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- documentIndex: *ControllerDoc
equal:
path: metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test
- it: jobTemplate metadata should pass
set:
controllers:
main:
type: job
pod:
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: Job
- documentIndex: *ControllerDoc
equal:
path: spec.template.metadata.annotations
value:
test_annotation: test
- documentIndex: *ControllerDoc
equal:
path: spec.template.metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME
test_label: test

View file

@ -1,92 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: controller metadata statefulset
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default metadata should pass
set:
controllers.main.type: statefulset
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: StatefulSet
- documentIndex: *ControllerDoc
notExists:
path: metadata.annotations
- documentIndex: *ControllerDoc
equal:
path: metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass
set:
controllers:
main:
type: statefulset
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: StatefulSet
- documentIndex: *ControllerDoc
equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *ControllerDoc
equal:
path: metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom metadata with global metadata should pass
set:
global:
labels:
global_label: test
annotations:
global_annotation: test
controllers:
main:
type: statefulset
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: StatefulSet
- documentIndex: *ControllerDoc
equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- documentIndex: *ControllerDoc
equal:
path: metadata.labels
value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test

View file

@ -0,0 +1,47 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: controller - presence
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
asserts:
- containsDocument:
apiVersion: apps/v1
kind: Deployment
name: release-name
any: true
- it: multiple controllers should pass
set:
controllers:
second:
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
apiVersion: apps/v1
kind: Deployment
name: release-name-main
any: true
- containsDocument:
apiVersion: apps/v1
kind: Deployment
name: release-name-second
any: true
- it: disabled should pass
set:
controllers.main.enabled: false
asserts:
- not: true
containsDocument:
apiVersion: apps/v1
kind: Deployment
name: release-name
any: true

View file

@ -1,138 +1,56 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: controller types
suite: controller - types
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
- it: should default to Deployment
asserts:
- documentIndex: &deploymentDoc 0
isKind:
of: Deployment
- documentIndex: *deploymentDoc
equal:
path: metadata.name
value: RELEASE-NAME
- documentIndex: *deploymentDoc
equal:
path: metadata.labels['app.kubernetes.io/component']
value: main
- it: additional controllers should pass
set:
controllers:
second:
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- hasDocuments:
count: 2
- documentIndex: &firstDeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *firstDeploymentDoc
equal:
path: metadata.name
value: RELEASE-NAME-main
- documentIndex: *firstDeploymentDoc
equal:
path: metadata.labels['app.kubernetes.io/component']
value: main
- documentIndex: &secondDeploymentDoc 1
isKind:
of: Deployment
- documentIndex: *secondDeploymentDoc
equal:
path: metadata.name
value: RELEASE-NAME-second
- documentIndex: *secondDeploymentDoc
equal:
path: metadata.labels['app.kubernetes.io/component']
value: second
- it: additional controllers with nameOverride should pass
set:
controllers:
main:
nameOverride: "{{ .Release.Name }}"
second:
nameOverride: testOverride
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- hasDocuments:
count: 2
- documentIndex: &firstDeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *firstDeploymentDoc
equal:
path: metadata.name
value: RELEASE-NAME
- documentIndex: *firstDeploymentDoc
equal:
path: metadata.labels['app.kubernetes.io/component']
value: main
- documentIndex: &secondDeploymentDoc 1
isKind:
of: Deployment
- documentIndex: *secondDeploymentDoc
equal:
path: metadata.name
value: RELEASE-NAME-testOverride
- documentIndex: *secondDeploymentDoc
equal:
path: metadata.labels['app.kubernetes.io/component']
value: second
- containsDocument:
apiVersion: apps/v1
kind: Deployment
name: release-name
any: true
- it: daemonset should pass
set:
controllers.main.type: daemonset
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: DaemonSet
- documentIndex: *ControllerDoc
equal:
path: metadata.name
value: RELEASE-NAME
- containsDocument:
apiVersion: apps/v1
kind: DaemonSet
name: release-name
any: true
- it: statefulset should pass
set:
controllers.main.type: statefulset
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: StatefulSet
- documentIndex: *ControllerDoc
equal:
path: metadata.name
value: RELEASE-NAME
- containsDocument:
apiVersion: apps/v1
kind: StatefulSet
name: release-name
any: true
- it: cronjob should pass
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: CronJob
- documentIndex: *ControllerDoc
equal:
path: metadata.name
value: RELEASE-NAME
- containsDocument:
apiVersion: batch/v1
kind: CronJob
name: release-name
any: true
- it: disabled should pass
- it: job should pass
set:
controllers.main.enabled: false
controllers.main.type: job
asserts:
- hasDocuments:
count: 0
- containsDocument:
apiVersion: batch/v1
kind: Job
name: release-name
any: true

View file

@ -0,0 +1,30 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - fields - concurrencyPolicy
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.concurrencyPolicy
value: Forbid
- it: custom configuration should pass
set:
controllers.main.cronjob.concurrencyPolicy: Test
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.concurrencyPolicy
value: Test

View file

@ -0,0 +1,30 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - fields - failedJobsHistory
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.failedJobsHistoryLimit
value: 1
- it: custom configuration should pass
set:
controllers.main.cronjob.failedJobsHistory: 2
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.failedJobsHistoryLimit
value: 2

View file

@ -0,0 +1,29 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - fields - parallelism
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- notExists:
path: spec.parallelism
- it: custom configuration should pass
set:
controllers.main.cronjob.parallelism: 3
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.jobTemplate.spec.parallelism
value: 3

View file

@ -0,0 +1,30 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - fields - restartPolicy
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.jobTemplate.spec.template.spec.restartPolicy
value: Never
- it: custom configuration should pass
set:
controllers.main.pod.restartPolicy: OnFailure
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.jobTemplate.spec.template.spec.restartPolicy
value: OnFailure

View file

@ -0,0 +1,30 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - fields - successfulJobsHistory
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.successfulJobsHistoryLimit
value: 1
- it: custom configuration should pass
set:
controllers.main.cronjob.successfulJobsHistory: 3
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.successfulJobsHistoryLimit
value: 3

View file

@ -0,0 +1,30 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - fields - suspend
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.suspend
value: false
- it: custom configuration should pass
set:
controllers.main.cronjob.suspend: true
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.suspend
value: true

View file

@ -0,0 +1,29 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - fields - ttlSecondsAfterFinished
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- notExists:
path: spec.jobTemplate.spec.ttlSecondsAfterFinished
- it: custom configuration should pass
set:
controllers.main.cronjob.ttlSecondsAfterFinished: 3600
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.jobTemplate.spec.ttlSecondsAfterFinished
value: 3600

View file

@ -0,0 +1,49 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - metadata - annotations
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
tests:
- it: no annotations are set by default
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- notExists:
path: metadata.annotations
- it: custom annotations
set:
controllers.main.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
test_annotation: test
- it: custom annotations mixed with global annotations
set:
global.annotations:
global_annotation: test
controllers.main.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test

View file

@ -0,0 +1,25 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - jobTemplate - metadata - annotations
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
tests:
- it: jobTemplate metadata should pass
set:
controllers.main.pod.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.jobTemplate.spec.template.metadata.annotations
value:
test_annotation: test

View file

@ -0,0 +1,28 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - jobTemplate - metadata - labels
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
tests:
- it: jobTemplate metadata should pass
set:
controllers.main.pod.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.jobTemplate.spec.template.metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME
test_label: test

View file

@ -0,0 +1,65 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - metadata - labels
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
tests:
- it: default labels
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom labels
set:
controllers.main.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom labels mixed with global labels
set:
global.labels:
global_label: test
controllers.main.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test

View file

@ -0,0 +1,219 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - metadata - name
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
tests:
- it: name defaults to chart fullName
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name
any: true
- it: forceRename
set:
controllers.main.forceRename: forceRename
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: forcerename
any: true
- it: forceRename with template
set:
controllers.main.forceRename: "{{ .Chart.Name }}"
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: common-test
any: true
- it: prefix
set:
controllers.main.prefix: prefix
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: prefix-release-name
any: true
- it: prefix with template
set:
controllers.main.prefix: "{{ .Chart.Name }}-prefix"
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: common-test-prefix-release-name
any: true
- it: suffix
set:
controllers.main.suffix: suffix
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-suffix
any: true
- it: suffix with template
set:
controllers.main.suffix: "{{ .Chart.Name }}-suffix"
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-common-test-suffix
any: true
- it: both prefix and suffix
set:
controllers.main.prefix: prefix
controllers.main.suffix: suffix
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: prefix-release-name-suffix
any: true
- it: prefix, suffix and forceRename (illegal combination)
set:
controllers.main.forceRename: forceRename
controllers.main.prefix: prefix
controllers.main.suffix: suffix
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"
- it: multiple items
set:
controllers:
second:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-main
any: true
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-second
any: true
- it: multiple items with prefix
set:
controllers:
second:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
prefix: prefix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-main
any: true
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: prefix-release-name-second
any: true
- it: multiple items with suffix
set:
controllers:
second:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
suffix: suffix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-main
any: true
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-second-suffix
any: true
- it: multiple items with prefix and suffix
set:
controllers:
second:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
prefix: prefix
suffix: suffix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-main
any: true
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: prefix-release-name-second-suffix
any: true
- it: multiple items with prefix, suffix and forceRename (illegal combination)
set:
controllers:
second:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
forceRename: forceRename
prefix: prefix
suffix: suffix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"

View file

@ -0,0 +1,42 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: daemonset - fields - revisionHistoryLimit
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: daemonset
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "DaemonSet")].metadata.name
value: release-name
asserts:
- equal:
path: spec.revisionHistoryLimit
value: 3
- it: custom revisionHistoryLimit
set:
controllers.main:
revisionHistoryLimit: 8
documentSelector:
path: $[?(@.kind == "DaemonSet")].metadata.name
value: release-name
asserts:
- equal:
path: spec.revisionHistoryLimit
value: 8
- it: explicit revisionHistoryLimit 0 should pass
set:
controllers.main:
revisionHistoryLimit: 0
documentSelector:
path: $[?(@.kind == "DaemonSet")].metadata.name
value: release-name
asserts:
- equal:
path: spec.revisionHistoryLimit
value: 0

View file

@ -0,0 +1,47 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: daemonset - metadata - annotations
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: daemonset
tests:
- it: no annotations are set by default
documentSelector:
path: $[?(@.kind == "DaemonSet")].metadata.name
value: release-name
asserts:
- notExists:
path: metadata.annotations
- it: custom annotations
set:
controllers.main.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "DaemonSet")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
test_annotation: test
- it: custom annotations mixed with global annotations
set:
global.annotations:
global_annotation: test
controllers.main.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "DaemonSet")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test

View file

@ -0,0 +1,63 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: daemonset - metadata - labels
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: daemonset
tests:
- it: default labels
documentSelector:
path: $[?(@.kind == "DaemonSet")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom labels
set:
controllers.main.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "DaemonSet")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom labels mixed with global labels
set:
global.labels:
global_label: test
controllers.main.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "DaemonSet")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test

View file

@ -0,0 +1,206 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: daemonset - metadata - name
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: daemonset
tests:
- it: name defaults to chart fullName
asserts:
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: release-name
any: true
- it: forceRename
set:
controllers.main.forceRename: forceRename
asserts:
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: forcerename
any: true
- it: forceRename with template
set:
controllers.main.forceRename: "{{ .Chart.Name }}"
asserts:
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: common-test
any: true
- it: prefix
set:
controllers.main.prefix: prefix
asserts:
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: prefix-release-name
any: true
- it: prefix with template
set:
controllers.main.prefix: "{{ .Chart.Name }}-prefix"
asserts:
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: common-test-prefix-release-name
any: true
- it: suffix
set:
controllers.main.suffix: suffix
asserts:
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: release-name-suffix
any: true
- it: suffix with template
set:
controllers.main.suffix: "{{ .Chart.Name }}-suffix"
asserts:
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: release-name-common-test-suffix
any: true
- it: both prefix and suffix
set:
controllers.main.prefix: prefix
controllers.main.suffix: suffix
asserts:
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: prefix-release-name-suffix
any: true
- it: prefix, suffix and forceRename (illegal combination)
set:
controllers.main.forceRename: forceRename
controllers.main.prefix: prefix
controllers.main.suffix: suffix
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"
- it: multiple items
set:
controllers:
second:
type: daemonset
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: release-name-main
any: true
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: release-name-second
any: true
- it: multiple items with prefix
set:
controllers:
second:
type: daemonset
prefix: prefix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: release-name-main
any: true
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: prefix-release-name-second
any: true
- it: multiple items with suffix
set:
controllers:
second:
type: daemonset
suffix: suffix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: release-name-main
any: true
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: release-name-second-suffix
any: true
- it: multiple items with prefix and suffix
set:
controllers:
second:
type: daemonset
prefix: prefix
suffix: suffix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: release-name-main
any: true
- containsDocument:
kind: DaemonSet
apiVersion: apps/v1
name: prefix-release-name-second-suffix
any: true
- it: multiple items with prefix, suffix and forceRename (illegal combination)
set:
controllers:
second:
type: daemonset
forceRename: forceRename
prefix: prefix
suffix: suffix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"

View file

@ -0,0 +1,42 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: deployment - fields - revisionHistoryLimit
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: deployment
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.revisionHistoryLimit
value: 3
- it: custom revisionHistoryLimit should pass
set:
controllers.main:
revisionHistoryLimit: 8
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.revisionHistoryLimit
value: 8
- it: explicit revisionHistoryLimit 0 should pass
set:
controllers.main:
revisionHistoryLimit: 0
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: spec.revisionHistoryLimit
value: 0

View file

@ -0,0 +1,47 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: deployment - metadata - annotations
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: deployment
tests:
- it: no annotations are set by default
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- notExists:
path: metadata.annotations
- it: custom annotations
set:
controllers.main.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
test_annotation: test
- it: custom annotations mixed with global annotations
set:
global.annotations:
global_annotation: test
controllers.main.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test

View file

@ -0,0 +1,63 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: deployment - metadata - labels
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: deployment
tests:
- it: default labels
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom labels
set:
controllers.main.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom labels mixed with global labels
set:
global.labels:
global_label: test
controllers.main.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test

View file

@ -0,0 +1,199 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: deployment - metadata - name
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: name defaults to chart fullName
asserts:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: release-name
any: true
- it: forceRename
set:
controllers.main.forceRename: forceRename
asserts:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: forcerename
any: true
- it: forceRename with template
set:
controllers.main.forceRename: "{{ .Chart.Name }}"
asserts:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: common-test
any: true
- it: prefix
set:
controllers.main.prefix: prefix
asserts:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: prefix-release-name
any: true
- it: prefix with template
set:
controllers.main.prefix: "{{ .Chart.Name }}-prefix"
asserts:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: common-test-prefix-release-name
any: true
- it: suffix
set:
controllers.main.suffix: suffix
asserts:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: release-name-suffix
any: true
- it: suffix with template
set:
controllers.main.suffix: "{{ .Chart.Name }}-suffix"
asserts:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: release-name-common-test-suffix
any: true
- it: both prefix and suffix
set:
controllers.main.prefix: prefix
controllers.main.suffix: suffix
asserts:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: prefix-release-name-suffix
any: true
- it: prefix, suffix and forceRename (illegal combination)
set:
controllers.main.forceRename: forceRename
controllers.main.prefix: prefix
controllers.main.suffix: suffix
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"
- it: multiple items
set:
controllers:
second:
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: release-name-main
any: true
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: release-name-second
any: true
- it: multiple items with prefix
set:
controllers:
second:
prefix: prefix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: release-name-main
any: true
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: prefix-release-name-second
any: true
- it: multiple items with suffix
set:
controllers:
second:
suffix: suffix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: release-name-main
any: true
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: release-name-second-suffix
any: true
- it: multiple items with prefix and suffix
set:
controllers:
second:
prefix: prefix
suffix: suffix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: release-name-main
any: true
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: prefix-release-name-second-suffix
any: true
- it: multiple items with prefix, suffix and forceRename (illegal combination)
set:
controllers:
second:
forceRename: forceRename
prefix: prefix
suffix: suffix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"

View file

@ -0,0 +1,53 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress - fields - hosts - host
templates:
- common.yaml
values:
- ../_values/ingress_main_default_hosts.yaml
- ../_values/service_main_default.yaml
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- equal:
path: spec.rules[0].host
value: chart-example.local
- it: custom host should pass
set:
ingress.main:
hosts:
- host: chart-test.local
paths:
- path: /test
service:
identifier: main
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- equal:
path: spec.rules[0].host
value: chart-test.local
- it: host with template should pass
set:
ingress.main:
hosts:
- host: "{{ .Release.Name }}.hostname"
paths:
- path: /
service:
identifier: main
port: http
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- equal:
path: spec.rules[0].host
value: RELEASE-NAME.hostname

View file

@ -0,0 +1,52 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress - fields - hosts - paths - path
templates:
- common.yaml
values:
- ../_values/ingress_main_default_hosts.yaml
- ../_values/service_main_default.yaml
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- equal:
path: spec.rules[0].http.paths[0].path
value: "/"
- it: custom path should pass
set:
ingress.main:
hosts:
- host: chart-test.local
paths:
- path: /test
service:
identifier: main
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- equal:
path: spec.rules[0].http.paths[0].path
value: "/test"
- it: path with template should pass
set:
ingress.main:
hosts:
- host: chart-test.local
paths:
- path: "/{{ .Release.Name }}.path"
service:
identifier: main
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- equal:
path: spec.rules[0].http.paths[0].path
value: "/RELEASE-NAME.path"

View file

@ -1,6 +1,6 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress service reference
suite: ingress - fields - hosts - paths - service
templates:
- common.yaml
values:
@ -15,12 +15,11 @@ tests:
ports:
http:
port: &httpPort 8081
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
- equal:
path: spec.rules[0].http.paths[0].backend
value:
service:
@ -38,12 +37,11 @@ tests:
service:
name: pathService
port: 1234
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- documentIndex: &IngressDocument 1
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
- equal:
path: spec.rules[0].http.paths[0].backend
value:
service:
@ -59,21 +57,75 @@ tests:
paths:
- path: /
service:
name: "{{ .Release.Name }}"
name: "{{ .Release.Name | lower }}"
port: 1234
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- documentIndex: &IngressDocument 1
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
- equal:
path: spec.rules[0].http.paths[0].backend
value:
service:
name: RELEASE-NAME
name: release-name
port:
number: 1234
- it: automatic service and port reference should pass
set:
service:
main:
controller: main
ports:
http:
port: 8081
http2:
port: 1880
ingress:
main:
className: "nginx"
hosts:
- host: http.chart-test.local
paths:
- path: /
pathType: Prefix
- host: http2.chart-test.local
paths:
- path: /
pathType: Prefix
service:
port: http2
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
# First Ingress host
- equal:
path: spec.rules[0].host
value: http.chart-test.local
- equal:
path: spec.rules[0].http.paths[0].path
value: "/"
- equal:
path: spec.rules[0].http.paths[0].backend.service.name
value: release-name
- equal:
path: spec.rules[0].http.paths[0].backend.service.port.number
value: 8081
# Second Ingress host
- equal:
path: spec.rules[1].host
value: http2.chart-test.local
- equal:
path: spec.rules[1].http.paths[0].path
value: "/"
- equal:
path: spec.rules[1].http.paths[0].backend.service.name
value: release-name
- equal:
path: spec.rules[1].http.paths[0].backend.service.port.number
value: 1880
- it: multiple hosts with port name references should pass
set:
service:
@ -103,41 +155,33 @@ tests:
service:
identifier: main
port: http2
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
# First Ingress host
- documentIndex: *IngressDocument
equal:
- equal:
path: spec.rules[0].host
value: http.chart-test.local
- documentIndex: *IngressDocument
equal:
- equal:
path: spec.rules[0].http.paths[0].path
value: "/"
- documentIndex: *IngressDocument
equal:
- equal:
path: spec.rules[0].http.paths[0].backend.service.name
value: "RELEASE-NAME"
- documentIndex: *IngressDocument
equal:
value: release-name
- equal:
path: spec.rules[0].http.paths[0].backend.service.port.number
value: *httpPort
# Second Ingress host
- documentIndex: *IngressDocument
equal:
- equal:
path: spec.rules[1].host
value: http2.chart-test.local
- documentIndex: *IngressDocument
equal:
- equal:
path: spec.rules[1].http.paths[0].path
value: "/"
- documentIndex: *IngressDocument
equal:
- equal:
path: spec.rules[1].http.paths[0].backend.service.name
value: "RELEASE-NAME"
- documentIndex: *IngressDocument
equal:
value: release-name
- equal:
path: spec.rules[1].http.paths[0].backend.service.port.number
value: *http2Port

View file

@ -1,6 +1,6 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress tls
suite: ingress - fields - tls
templates:
- common.yaml
values:
@ -8,12 +8,11 @@ values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- documentIndex: &IngressDocument 1
isKind:
of: Ingress
- documentIndex: *IngressDocument
notExists:
- notExists:
path: spec.tls
- it: tls enabled should pass
@ -23,12 +22,11 @@ tests:
- secretName: test
hosts:
- hostname
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- documentIndex: &IngressDocument 1
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
- equal:
path: spec.tls[0]
value:
secretName: test
@ -41,12 +39,11 @@ tests:
tls:
- hosts:
- hostname
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- documentIndex: &IngressDocument 1
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
- equal:
path: spec.tls[0]
value:
hosts:
@ -56,18 +53,17 @@ tests:
set:
ingress.main:
tls:
- secretName: "{{ .Release.Name }}-secret"
- secretName: "{{ .Release.Name | lower }}-secret"
hosts:
- hostname
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- documentIndex: &IngressDocument 1
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
- equal:
path: spec.tls[0]
value:
secretName: RELEASE-NAME-secret
secretName: release-name-secret
hosts:
- hostname
@ -78,12 +74,11 @@ tests:
- secretName: '{{ "" }}'
hosts:
- hostname
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- documentIndex: &IngressDocument 1
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
- equal:
path: spec.tls[0]
value:
hosts:

View file

@ -0,0 +1,31 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress - fields - defaultBackend
templates:
- common.yaml
values:
- ../_values/ingress_main_default_hosts.yaml
- ../_values/service_main_default.yaml
- ../_values/controllers_main_default_container.yaml
tests:
- it: with defaultBackend should pass
set:
ingress.main:
defaultBackend:
resource:
apiGroup: k8s.example.com
kind: StorageBucket
name: static-assets
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- equal:
path: spec.defaultBackend
value:
resource:
apiGroup: k8s.example.com
kind: StorageBucket
name: static-assets
- notExists:
path: spec.rules

View file

@ -0,0 +1,61 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: "ingress - metadata - annotations"
templates:
- common.yaml
values:
- ../_values/ingress_main_default_hosts.yaml
- ../_values/controllers_main_default_container.yaml
tests:
- it: no annotations are set by default
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- notExists:
path: metadata.annotations
- it: custom annotations
set:
ingress.main.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
test_annotation: test
- it: custom annotations mixed with global annotations
set:
global.annotations:
global_annotation: test
ingress.main.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- it: custom annotations with templates
set:
ingress.main.annotations:
template_annotation1: "{{ .Release.Name | lower }}"
template_annotation2: "{{ .Chart.Name | lower }}"
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations["template_annotation1"]
value: release-name
- equal:
path: metadata.annotations["template_annotation2"]
value: common-test

View file

@ -0,0 +1,74 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: "ingress - metadata - labels"
templates:
- common.yaml
values:
- ../_values/ingress_main_default_hosts.yaml
- ../_values/controllers_main_default_container.yaml
tests:
- it: default labels
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom labels
set:
ingress.main.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom labels mixed with global labels
set:
global.labels:
global_label: test
ingress.main.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom labels with templates
set:
ingress.main.labels:
template_label1: "{{ .Release.Name | lower }}"
template_label2: "{{ .Chart.Name | lower }}"
documentSelector:
path: $[?(@.kind == "Ingress")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels["template_label1"]
value: release-name
- equal:
path: metadata.labels["template_label2"]
value: common-test

View file

@ -0,0 +1,211 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress - metadata - name
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
- ../_values/ingress_main_default_hosts.yaml
- ../_values/service_main_default.yaml
tests:
- it: name defaults to chart fullName
asserts:
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: release-name
any: true
- it: forceRename
set:
ingress.main.forceRename: forceRename
asserts:
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: forcerename
any: true
- it: forceRename with template
set:
ingress.main.forceRename: "{{ .Chart.Name }}"
asserts:
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: common-test
any: true
- it: prefix
set:
ingress.main.prefix: prefix
asserts:
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: prefix-release-name
any: true
- it: prefix with template
set:
ingress.main.prefix: "{{ .Chart.Name }}"
asserts:
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: common-test-release-name
any: true
- it: suffix
set:
ingress.main.suffix: suffix
asserts:
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: release-name-suffix
any: true
- it: suffix with template
set:
ingress.main.suffix: "{{ .Chart.Name }}"
asserts:
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: release-name-common-test
any: true
- it: both prefix and suffix
set:
ingress.main.prefix: prefix
ingress.main.suffix: suffix
asserts:
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: prefix-release-name-suffix
any: true
- it: prefix, suffix and forceRename (illegal combination)
set:
ingress.main.forceRename: forceRename
ingress.main.prefix: prefix
ingress.main.suffix: suffix
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"
- it: multiple items
set:
ingress:
second:
hosts:
- host: "chart-example.local"
paths:
- path: /
service:
name: RELEASE-NAME
port: 8081
asserts:
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: release-name-main
any: true
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: release-name-second
any: true
- it: multiple items with prefix
set:
ingress:
second:
prefix: prefix
hosts:
- host: "chart-example.local"
paths:
- path: /
service:
name: RELEASE-NAME
port: 8081
asserts:
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: release-name-main
any: true
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: prefix-release-name-second
any: true
- it: multiple items with suffix
set:
ingress:
second:
suffix: suffix
hosts:
- host: "chart-example.local"
paths:
- path: /
service:
name: RELEASE-NAME
port: 8081
asserts:
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: release-name-main
any: true
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: release-name-second-suffix
any: true
- it: multiple items with prefix and suffix
set:
ingress:
second:
prefix: prefix
suffix: suffix
hosts:
- host: "chart-example.local"
paths:
- path: /
service:
name: RELEASE-NAME
port: 8081
asserts:
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: release-name-main
any: true
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/v1
name: prefix-release-name-second-suffix
any: true
- it: multiple items with prefix, suffix and forceRename (illegal combination)
set:
ingress:
second:
forceRename: forceRename
prefix: prefix
suffix: suffix
hosts:
- host: "chart-example.local"
paths:
- path: /
service:
name: RELEASE-NAME
port: 8081
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"

View file

@ -1,115 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress metadata
templates:
- common.yaml
values:
- ../_values/ingress_main_default_hosts.yaml
- ../_values/controllers_main_default_container.yaml
tests:
- it: default metadata should pass
asserts:
- documentIndex: &IngressDocument 1
isKind:
of: Ingress
- documentIndex: *IngressDocument
notExists:
path: metadata.annotations
- documentIndex: *IngressDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass
set:
ingress.main:
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &IngressDocument 1
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *IngressDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom metadata with global metadata should pass
set:
global:
labels:
global_label: test
annotations:
global_annotation: test
ingress.main:
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &IngressDocument 1
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- documentIndex: *IngressDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom metadata with templates should pass
set:
ingress.main:
annotations:
template_annotation1: "{{ .Release.Name | lower }}"
template_annotation2: "{{ .Chart.Name | lower }}"
labels:
template_label1: "{{ .Release.Name | lower }}"
template_label2: "{{ .Chart.Name | lower }}"
asserts:
- documentIndex: &IngressDocument 1
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: metadata.annotations["template_annotation1"]
value: release-name
- documentIndex: *IngressDocument
equal:
path: metadata.annotations["template_annotation2"]
value: common-test
- documentIndex: *IngressDocument
equal:
path: metadata.labels["template_label1"]
value: release-name
- documentIndex: *IngressDocument
equal:
path: metadata.labels["template_label2"]
value: common-test

View file

@ -1,20 +1,18 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress presence
suite: ingress - presence
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
asserts:
- hasDocuments:
count: 1
- documentIndex: 0
not: true
isKind:
of: Ingress
- not: true
containsDocument:
apiVersion: networking.k8s.io/v1
kind: Ingress
any: true
- it: explicitly disabled should pass
values:
@ -22,12 +20,11 @@ tests:
set:
ingress.main.enabled: false
asserts:
- hasDocuments:
count: 1
- documentIndex: 0
not: true
isKind:
of: Ingress
- not: true
containsDocument:
apiVersion: networking.k8s.io/v1
kind: Ingress
any: true
- it: explicitly enabled should pass
values:
@ -35,15 +32,11 @@ tests:
set:
ingress.main.enabled: true
asserts:
- hasDocuments:
count: 2
- documentIndex: 0
not: true
isKind:
of: Ingress
- documentIndex: 1
isKind:
of: Ingress
- containsDocument:
apiVersion: networking.k8s.io/v1
kind: Ingress
name: release-name
any: true
- it: multiple ingress should pass
values:
@ -59,30 +52,16 @@ tests:
identifier: main
port: http
asserts:
- hasDocuments:
count: 4
- documentIndex: 0
not: true
isKind:
of: Ingress
- documentIndex: 1
not: true
isKind:
of: Ingress
- documentIndex: &FirstIngressDocument 2
isKind:
of: Ingress
- documentIndex: *FirstIngressDocument
equal:
path: metadata.name
value: RELEASE-NAME-main
- documentIndex: &SecondIngressDocument 3
isKind:
of: Ingress
- documentIndex: *SecondIngressDocument
equal:
path: metadata.name
value: RELEASE-NAME-test
- containsDocument:
apiVersion: networking.k8s.io/v1
kind: Ingress
name: release-name-main
any: true
- containsDocument:
apiVersion: networking.k8s.io/v1
kind: Ingress
name: release-name-test
any: true
- it: multiple ingress with explicit disabled should pass
values:
@ -98,16 +77,14 @@ tests:
identifier: main
port: http
asserts:
- hasDocuments:
count: 2
- documentIndex: 0
not: true
isKind:
of: Ingress
- documentIndex: &FirstIngressDocument 1
isKind:
of: Ingress
- documentIndex: *FirstIngressDocument
equal:
path: metadata.name
value: RELEASE-NAME
- containsDocument:
apiVersion: networking.k8s.io/v1
kind: Ingress
name: release-name
any: true
- not: true
containsDocument:
apiVersion: networking.k8s.io/v1
kind: Ingress
name: release-name-test
any: true

View file

@ -0,0 +1,55 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress - validations
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: service reference to non-existing service should fail
set:
ingress.main.hosts:
- host: "chart-example.local"
paths:
- path: /
service:
identifier: main
port: 8081
asserts:
- failedTemplate:
errorMessage: "No enabled Service found with this identifier. (ingress: 'main', path: '/', identifier: 'main')"
- it: automatic service determination should fail when no service is enabled
set:
ingress.main.hosts:
- host: "chart-example.local"
paths:
- path: /
service:
port: 8081
asserts:
- failedTemplate:
errorMessage: "Either service.name or service.identifier is required because automatic Service detection is not possible. (ingress: main, host: chart-example.local, path: /)"
- it: automatic service determination should fail when >1 service is enabled
set:
service:
main:
controller: main
ports:
ui:
port: 8082
second:
controller: main
ports:
ui:
port: 8082
ingress.main.hosts:
- host: "chart-example.local"
paths:
- path: /
service:
port: 8081
asserts:
- failedTemplate:
errorMessage: "Either service.name or service.identifier is required because automatic Service detection is not possible. (ingress: main, host: chart-example.local, path: /)"

View file

@ -1,132 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: ingress values
templates:
- common.yaml
values:
- ../_values/ingress_main_default_hosts.yaml
- ../_values/service_main_default.yaml
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: spec.rules[0].host
value: chart-example.local
- documentIndex: *IngressDocument
equal:
path: spec.rules[0].http.paths[0].path
value: "/"
- it: nameOverride should pass
set:
ingress.main:
nameOverride: test
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: metadata.name
value: RELEASE-NAME-test
- it: nameOverride with template should pass
set:
ingress.main:
nameOverride: "{{ .Release.Name }}"
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: metadata.name
value: RELEASE-NAME
- it: custom host and path should pass
set:
ingress.main:
hosts:
- host: chart-test.local
paths:
- path: /test
service:
identifier: main
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: spec.rules[0].host
value: chart-test.local
- documentIndex: *IngressDocument
equal:
path: spec.rules[0].http.paths[0].path
value: "/test"
- it: host with template should pass
set:
ingress.main:
hosts:
- host: "{{ .Release.Name }}.hostname"
paths:
- path: /
service:
identifier: main
port: http
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: spec.rules[0].host
value: RELEASE-NAME.hostname
- it: path with template should pass
set:
ingress.main:
hosts:
- host: chart-test.local
paths:
- path: "/{{ .Release.Name }}.path"
service:
identifier: main
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: spec.rules[0].http.paths[0].path
value: "/RELEASE-NAME.path"
- it: with defaultBackend should pass
set:
ingress.main:
defaultBackend:
resource:
apiGroup: k8s.example.com
kind: StorageBucket
name: static-assets
asserts:
- documentIndex: &IngressDocument 2
isKind:
of: Ingress
- documentIndex: *IngressDocument
equal:
path: spec.defaultBackend
value:
resource:
apiGroup: k8s.example.com
kind: StorageBucket
name: static-assets
- documentIndex: *IngressDocument
notExists:
path: spec.rules

View file

@ -0,0 +1,29 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: job - fields - backoffLimit
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: job
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- equal:
path: spec.backoffLimit
value: 6
- it: custom configuration should pass
set:
controllers.main.job.backoffLimit: 3
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- equal:
path: spec.backoffLimit
value: 3

View file

@ -0,0 +1,28 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: job - fields - parallelism
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: job
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- notExists:
path: spec.parallelism
- it: custom configuration should pass
set:
controllers.main.job.parallelism: 3
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- equal:
path: spec.parallelism
value: 3

View file

@ -0,0 +1,29 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: job - fields - restartPolicy
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: job
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.restartPolicy
value: Never
- it: custom configuration should pass
set:
controllers.main.pod.restartPolicy: OnFailure
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.spec.restartPolicy
value: OnFailure

View file

@ -0,0 +1,29 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: job - fields - suspend
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: job
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- equal:
path: spec.suspend
value: false
- it: custom configuration should pass
set:
controllers.main.job.suspend: true
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- equal:
path: spec.suspend
value: true

View file

@ -0,0 +1,28 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: job - fields - ttlSecondsAfterFinished
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: job
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- notExists:
path: spec.ttlSecondsAfterFinished
- it: custom configuration should pass
set:
controllers.main.job.ttlSecondsAfterFinished: 3600
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- equal:
path: spec.ttlSecondsAfterFinished
value: 3600

View file

@ -0,0 +1,47 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: job - metadata - annotations
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: job
tests:
- it: no annotations are set by default
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- notExists:
path: metadata.annotations
- it: custom annotations
set:
controllers.main.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
test_annotation: test
- it: custom annotations mixed with global annotations
set:
global.annotations:
global_annotation: test
controllers.main.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test

View file

@ -0,0 +1,23 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: job - jobTemplate - metadata - annotations
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: job
tests:
- it: jobTemplate metadata should pass
set:
controllers.main.pod.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.metadata.annotations
value:
test_annotation: test

View file

@ -0,0 +1,26 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: job - jobTemplate - metadata - labels
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: job
tests:
- it: jobTemplate metadata should pass
set:
controllers.main.pod.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- equal:
path: spec.template.metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME
test_label: test

View file

@ -0,0 +1,63 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: job - metadata - labels
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: job
tests:
- it: default labels
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom labels
set:
controllers.main.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom labels mixed with global labels
set:
global.labels:
global_label: test
controllers.main.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "Job")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test

View file

@ -0,0 +1,206 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: job - metadata - name
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: job
tests:
- it: name defaults to chart fullName
asserts:
- containsDocument:
kind: Job
apiVersion: batch/v1
name: release-name
any: true
- it: forceRename
set:
controllers.main.forceRename: forceRename
asserts:
- containsDocument:
kind: Job
apiVersion: batch/v1
name: forcerename
any: true
- it: forceRename with template
set:
controllers.main.forceRename: "{{ .Chart.Name }}"
asserts:
- containsDocument:
kind: Job
apiVersion: batch/v1
name: common-test
any: true
- it: prefix
set:
controllers.main.prefix: prefix
asserts:
- containsDocument:
kind: Job
apiVersion: batch/v1
name: prefix-release-name
any: true
- it: prefix with template
set:
controllers.main.prefix: "{{ .Chart.Name }}-prefix"
asserts:
- containsDocument:
kind: Job
apiVersion: batch/v1
name: common-test-prefix-release-name
any: true
- it: suffix
set:
controllers.main.suffix: suffix
asserts:
- containsDocument:
kind: Job
apiVersion: batch/v1
name: release-name-suffix
any: true
- it: suffix with template
set:
controllers.main.suffix: "{{ .Chart.Name }}-suffix"
asserts:
- containsDocument:
kind: Job
apiVersion: batch/v1
name: release-name-common-test-suffix
any: true
- it: both prefix and suffix
set:
controllers.main.prefix: prefix
controllers.main.suffix: suffix
asserts:
- containsDocument:
kind: Job
apiVersion: batch/v1
name: prefix-release-name-suffix
any: true
- it: prefix, suffix and forceRename (illegal combination)
set:
controllers.main.forceRename: forceRename
controllers.main.prefix: prefix
controllers.main.suffix: suffix
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"
- it: multiple items
set:
controllers:
second:
type: job
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: Job
apiVersion: batch/v1
name: release-name-main
any: true
- containsDocument:
kind: Job
apiVersion: batch/v1
name: release-name-second
any: true
- it: multiple items with prefix
set:
controllers:
second:
type: job
prefix: prefix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: Job
apiVersion: batch/v1
name: release-name-main
any: true
- containsDocument:
kind: Job
apiVersion: batch/v1
name: prefix-release-name-second
any: true
- it: multiple items with suffix
set:
controllers:
second:
type: job
suffix: suffix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: Job
apiVersion: batch/v1
name: release-name-main
any: true
- containsDocument:
kind: Job
apiVersion: batch/v1
name: release-name-second-suffix
any: true
- it: multiple items with prefix and suffix
set:
controllers:
second:
type: job
prefix: prefix
suffix: suffix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: Job
apiVersion: batch/v1
name: release-name-main
any: true
- containsDocument:
kind: Job
apiVersion: batch/v1
name: prefix-release-name-second-suffix
any: true
- it: multiple items with prefix, suffix and forceRename (illegal combination)
set:
controllers:
second:
type: job
forceRename: forceRename
prefix: prefix
suffix: suffix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"

View file

@ -1,6 +1,6 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: nameOverride tests
suite: misc - global nameOverride test
templates:
- common.yaml
values:
@ -8,22 +8,18 @@ values:
tests:
- it: default name is set to release name
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: Deployment
- documentIndex: *ControllerDoc
equal:
path: metadata.name
value: RELEASE-NAME
- containsDocument:
apiVersion: apps/v1
kind: Deployment
name: release-name
any: true
- it: global.nameOverride can be set
set:
global.nameOverride: custom-name
asserts:
- documentIndex: &ControllerDoc 0
isKind:
of: Deployment
- documentIndex: *ControllerDoc
equal:
path: metadata.name
value: RELEASE-NAME-custom-name
- containsDocument:
apiVersion: apps/v1
kind: Deployment
name: release-name-custom-name
any: true

View file

@ -0,0 +1,46 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: networkPolicy - fields - podSelector
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: networkpolicy targets the correct controller by default
set:
networkpolicies:
main:
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
documentSelector:
path: $[?(@.kind == "NetworkPolicy")].metadata.name
value: release-name
asserts:
- equal:
path: spec.podSelector
value:
matchLabels:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME
- it: networkpolicy targets supports custom podSelector
set:
networkpolicies:
main:
controller: main
policyTypes:
- Ingress
- Egress
podSelector: {}
rules: {}
documentSelector:
path: $[?(@.kind == "NetworkPolicy")].metadata.name
value: release-name
asserts:
- equal:
path: spec.podSelector
value: {}

View file

@ -0,0 +1,33 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: networkPolicy - fields - rules
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: networkpolicy rules are passed through
set:
networkpolicies:
main:
controller: main
policyTypes:
- Ingress
- Egress
rules:
ingress:
- {}
egress:
- {}
documentSelector:
path: $[?(@.kind == "NetworkPolicy")].metadata.name
value: release-name
asserts:
- equal:
path: spec.ingress
value:
- {}
- equal:
path: spec.egress
value:
- {}

View file

@ -0,0 +1,51 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: "networkPolicy - metadata - annotations"
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
networkpolicies.main:
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
tests:
- it: no annotations are set by default
documentSelector:
path: $[?(@.kind == "NetworkPolicy")].metadata.name
value: release-name
asserts:
- notExists:
path: metadata.annotations
- it: custom annotations
set:
networkpolicies.main.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "NetworkPolicy")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
test_annotation: test
- it: custom annotations mixed with global annotations
set:
global.annotations:
global_annotation: test
networkpolicies.main.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "NetworkPolicy")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test

View file

@ -0,0 +1,64 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: "networkPolicy - metadata - labels"
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
networkpolicies.main:
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
tests:
- it: default labels
documentSelector:
path: $[?(@.kind == "NetworkPolicy")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom labels
set:
networkpolicies.main.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "NetworkPolicy")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom labels mixed with global labels
set:
global.labels:
global_label: test
networkpolicies.main.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "NetworkPolicy")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test

View file

@ -0,0 +1,201 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: networkPolicy - metadata - name
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
networkpolicies.main:
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
tests:
- it: name defaults to chart fullName
asserts:
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: release-name
any: true
- it: forceRename
set:
networkpolicies.main.forceRename: forceRename
asserts:
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: forcerename
any: true
- it: forceRename with template
set:
networkpolicies.main.forceRename: "{{ .Chart.Name }}"
asserts:
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: common-test
any: true
- it: prefix
set:
networkpolicies.main.prefix: prefix
asserts:
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: prefix-release-name
any: true
- it: prefix with template
set:
networkpolicies.main.prefix: "{{ .Chart.Name }}"
asserts:
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: common-test-release-name
any: true
- it: suffix
set:
networkpolicies.main.suffix: suffix
asserts:
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: release-name-suffix
any: true
- it: suffix with template
set:
networkpolicies.main.suffix: "{{ .Chart.Name }}"
asserts:
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: release-name-common-test
any: true
- it: both prefix and suffix
set:
networkpolicies.main.prefix: prefix
networkpolicies.main.suffix: suffix
asserts:
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: prefix-release-name-suffix
any: true
- it: prefix, suffix and forceRename (illegal combination)
set:
networkpolicies.main.forceRename: forceRename
networkpolicies.main.prefix: prefix
networkpolicies.main.suffix: suffix
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"
- it: multiple items
set:
networkpolicies.second:
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
asserts:
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: release-name-main
any: true
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: release-name-second
any: true
- it: multiple items with prefix
set:
networkpolicies.second:
prefix: prefix
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
asserts:
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: release-name-main
any: true
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: prefix-release-name-second
any: true
- it: multiple items with suffix
set:
networkpolicies.second:
suffix: suffix
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
asserts:
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: release-name-main
any: true
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: release-name-second-suffix
any: true
- it: multiple items with prefix and suffix
set:
networkpolicies.second:
prefix: prefix
suffix: suffix
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
asserts:
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: release-name-main
any: true
- containsDocument:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
name: prefix-release-name-second-suffix
any: true
- it: multiple items with prefix, suffix and forceRename (illegal combination)
set:
networkpolicies.second:
forceRename: forceRename
prefix: prefix
suffix: suffix
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"

View file

@ -1,94 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: networkPolicy metadata
set:
networkpolicies.main:
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default metadata should pass
asserts:
- documentIndex: &NetworkPolicyDocument 1
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
notExists:
path: metadata.annotations
- documentIndex: *NetworkPolicyDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass
set:
networkpolicies:
main:
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &NetworkPolicyDocument 1
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *NetworkPolicyDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom metadata with global metadata should pass
set:
global:
labels:
global_label: test
annotations:
global_annotation: test
networkpolicies:
main:
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- documentIndex: &NetworkPolicyDocument 1
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- documentIndex: *NetworkPolicyDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test

View file

@ -1,85 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: networkPolicy names
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
set:
networkpolicies:
main:
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
asserts:
- hasDocuments:
count: 2
- documentIndex: &NetworkPolicyDocument 1
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
equal:
path: metadata.name
value: RELEASE-NAME
- it: custom name suffix should pass
set:
networkpolicies:
main:
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
nameOverride: block-ingress
asserts:
- documentIndex: &NetworkPolicyDocument 1
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
equal:
path: metadata.name
value: RELEASE-NAME-block-ingress
- it: multiple networkpolicies can be enabled
set:
networkpolicies:
primary:
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
secondary:
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
asserts:
- hasDocuments:
count: 3
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: &firstNetworkPolicyDocument 1
isKind:
of: NetworkPolicy
- documentIndex: *firstNetworkPolicyDocument
equal:
path: metadata.name
value: RELEASE-NAME-primary
- documentIndex: 2
isKind:
of: NetworkPolicy
- documentIndex: &secondNetworkPolicyDocument 2
isKind:
of: NetworkPolicy
- documentIndex: *secondNetworkPolicyDocument
equal:
path: metadata.name
value: RELEASE-NAME-secondary

View file

@ -0,0 +1,57 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: networkPolicy - presence
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: main networkpolicy is disabled by default
asserts:
- not: true
containsDocument:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
any: true
- it: main networkpolicy can be enabled
set:
networkpolicies.main:
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
asserts:
- containsDocument:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
name: release-name
any: true
- it: multiple networkpolicies can be enabled
set:
networkpolicies:
primary:
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
secondary:
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
asserts:
- containsDocument:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
name: release-name-primary
any: true
- containsDocument:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
name: release-name-secondary
any: true

View file

@ -1,17 +1,17 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: NetworkPolicy validations
suite: networkPolicy - validations
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
networkpolicies:
main:
controller: ""
rules: {}
tests:
- it: networkpolicy requires either controller reference or podSelector
set:
networkpolicies:
main:
controller: ""
rules: {}
asserts:
- failedTemplate:
errorMessage: "controller reference or podSelector is required for NetworkPolicy. (NetworkPolicy main)"
@ -22,7 +22,6 @@ tests:
main:
controller: main
policyTypes: []
rules: {}
asserts:
- failedTemplate:
errorMessage: "policyTypes is required for NetworkPolicy. (NetworkPolicy main)"
@ -34,7 +33,6 @@ tests:
controller: main
policyTypes:
- test
rules: {}
asserts:
- failedTemplate:
errorMessage: "Not a valid policyType for NetworkPolicy. (NetworkPolicy main, value test)"

View file

@ -1,103 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: NetworkPolicy values
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: main networkpolicy is disabled by default
asserts:
- hasDocuments:
count: 1
- documentIndex: 0
not: true
isKind:
of: NetworkPolicy
- it: main networkpolicy can be enabled
set:
networkpolicies.main:
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
asserts:
- hasDocuments:
count: 2
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 1
isKind:
of: NetworkPolicy
- it: networkpolicy targets the correct controller
set:
networkpolicies:
main:
controller: main
policyTypes:
- Ingress
- Egress
rules: {}
asserts:
- documentIndex: &NetworkPolicyDocument 1
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
equal:
path: spec.podSelector
value:
matchLabels:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME
- it: networkpolicy targets supports custom podSelector
set:
networkpolicies:
main:
controller: main
policyTypes:
- Ingress
- Egress
podSelector: {}
rules: {}
asserts:
- documentIndex: &NetworkPolicyDocument 1
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
equal:
path: spec.podSelector
value: {}
- it: networkpolicy rules are passed through
set:
networkpolicies:
main:
controller: main
policyTypes:
- Ingress
- Egress
rules:
ingress:
- {}
egress:
- {}
asserts:
- documentIndex: &NetworkPolicyDocument 1
isKind:
of: NetworkPolicy
- documentIndex: *NetworkPolicyDocument
equal:
path: spec.ingress
value:
- {}
- documentIndex: *NetworkPolicyDocument
equal:
path: spec.egress
value:
- {}

View file

@ -1,77 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: persistence secret
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: secret persistence type should pass
set:
persistence:
secret:
enabled: true
type: secret
name: mySettings
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
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:
enabled: true
type: secret
name: "{{ .Release.Name }}-config"
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
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:
secrets:
mySettings:
stringData:
test: testvalue
persistence:
secret:
type: secret
identifier: mySettings
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.volumes[0]
value:
name: secret
secret:
secretName: RELEASE-NAME-mySettings
- it: secret persistence type with invalid identifier reference should fail
set:
persistence:
secret:
type: secret
identifier: doesNotExist
asserts:
- failedTemplate:
errorMessage: "No secret found with this identifier. (persistence item 'secret', identifier 'doesNotExist')"

View file

@ -0,0 +1,27 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: persistence - validations
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: configmap persistence type with invalid identifier reference should fail
set:
persistence:
configmap:
type: configMap
identifier: doesNotExist
asserts:
- failedTemplate:
errorMessage: "No configmap found with this identifier. (persistence item 'configmap', identifier 'doesNotExist')"
- it: secret persistence type with invalid identifier reference should fail
set:
persistence:
secret:
type: secret
identifier: doesNotExist
asserts:
- failedTemplate:
errorMessage: "No secret found with this identifier. (persistence item 'secret', identifier 'doesNotExist')"

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

Some files were not shown because too many files have changed in this diff Show more