mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 08:57:04 +02:00
feat(common): Release version 2.0.0-beta.1 (#173)
This commit is contained in:
parent
19767d668c
commit
7b6ee00be6
189 changed files with 3110 additions and 3023 deletions
|
@ -0,0 +1,93 @@
|
|||
suite: configmap metadata
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
enabled: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &ConfigmapDocument 2
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *ConfigmapDocument
|
||||
isNull:
|
||||
path: metadata.annotations
|
||||
- documentIndex: *ConfigmapDocument
|
||||
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:
|
||||
configMaps:
|
||||
config:
|
||||
enabled: true
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &ConfigmapDocument 2
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *ConfigmapDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
test_annotation: test
|
||||
- documentIndex: *ConfigmapDocument
|
||||
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
|
||||
configMaps:
|
||||
config:
|
||||
enabled: true
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &ConfigmapDocument 2
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *ConfigmapDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
global_annotation: test
|
||||
test_annotation: test
|
||||
- documentIndex: *ConfigmapDocument
|
||||
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
|
91
charts/library/common-test/tests/configmap/names_test.yaml
Normal file
91
charts/library/common-test/tests/configmap/names_test.yaml
Normal file
|
@ -0,0 +1,91 @@
|
|||
suite: configMap names
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: 1
|
||||
not: true
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
|
||||
- it: with disabled configMap should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
enabled: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: 1
|
||||
not: true
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
|
||||
- it: with multiple configMap should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
enabled: true
|
||||
data:
|
||||
foo: bar
|
||||
secondary:
|
||||
enabled: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- documentIndex: &FirstConfigmapDocument 2
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *FirstConfigmapDocument
|
||||
isNotNull:
|
||||
path: metadata.name
|
||||
- documentIndex: &SecondConfigmapDocument 3
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *SecondConfigmapDocument
|
||||
isNotNull:
|
||||
path: metadata.name
|
||||
|
||||
- it: default name should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
enabled: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &ConfigmapDocument 2
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *ConfigmapDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-config
|
||||
|
||||
- it: with nameOverride should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
enabled: true
|
||||
nameOverride: http
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &ConfigmapDocument 2
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *ConfigmapDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-http
|
|
@ -0,0 +1,20 @@
|
|||
suite: configmap Pod metadata
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
enabled: true
|
||||
data:
|
||||
test: value 1
|
||||
asserts:
|
||||
- documentIndex: &ControllerDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *ControllerDoc
|
||||
equal:
|
||||
path: spec.template.metadata.annotations
|
||||
value:
|
||||
checksum/configMaps: afdf20f511621d5cb358c5e8b0da2d14cdbe2549fb12fa123f6a6e9baabef26e
|
73
charts/library/common-test/tests/container/args_test.yaml
Normal file
73
charts/library/common-test/tests/container/args_test.yaml
Normal file
|
@ -0,0 +1,73 @@
|
|||
suite: container args override
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
isNull:
|
||||
path: spec.template.spec.containers[0].args
|
||||
|
||||
- it: single string should pass
|
||||
set:
|
||||
controllers.main.containers.main.args: sleep infinity
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- sleep infinity
|
||||
|
||||
- it: multiline string should pass
|
||||
set:
|
||||
controllers.main.containers.main.args: |
|
||||
echo hello
|
||||
echo world
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- |
|
||||
echo hello
|
||||
echo world
|
||||
|
||||
- it: single quoted string should pass
|
||||
set:
|
||||
controllers.main.containers.main.args: "sleep infinity"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- sleep infinity
|
||||
|
||||
- it: list of strings should pass
|
||||
set:
|
||||
controllers.main.containers.main.args:
|
||||
- sleep
|
||||
- infinity
|
||||
- "test"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- sleep
|
||||
- infinity
|
||||
- test
|
71
charts/library/common-test/tests/container/command_test.yaml
Normal file
71
charts/library/common-test/tests/container/command_test.yaml
Normal file
|
@ -0,0 +1,71 @@
|
|||
suite: container command override
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
isNull:
|
||||
path: spec.template.spec.containers[0].command
|
||||
|
||||
- it: single string should pass
|
||||
set:
|
||||
controllers.main.containers.main.command: /bin/sh
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].command
|
||||
value:
|
||||
- /bin/sh
|
||||
|
||||
- it: multiline string should pass
|
||||
set:
|
||||
controllers.main.containers.main.command: |
|
||||
/bin/sh
|
||||
-c
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].command
|
||||
value:
|
||||
- |
|
||||
/bin/sh
|
||||
-c
|
||||
|
||||
- it: single quoted string should pass
|
||||
set:
|
||||
controllers.main.containers.main.command: "/bin/sh"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].command
|
||||
value:
|
||||
- /bin/sh
|
||||
|
||||
- it: list of strings should pass
|
||||
set:
|
||||
controllers.main.containers.main.command:
|
||||
- /bin/sh
|
||||
- "-c"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].command
|
||||
value:
|
||||
- /bin/sh
|
||||
- -c
|
154
charts/library/common-test/tests/container/env_test.yaml
Normal file
154
charts/library/common-test/tests/container/env_test.yaml
Normal file
|
@ -0,0 +1,154 @@
|
|||
suite: container env values
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
isNull:
|
||||
path: spec.template.spec.containers[0].env
|
||||
|
||||
- it: KeyValue string should pass
|
||||
set:
|
||||
controllers.main.containers.main.env:
|
||||
string: value_of_env
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].env[0]
|
||||
value:
|
||||
name: string
|
||||
value: value_of_env
|
||||
|
||||
- it: KeyValue float should pass
|
||||
set:
|
||||
controllers.main.containers.main.env:
|
||||
string: 4.2
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].env[0]
|
||||
value:
|
||||
name: string
|
||||
value: "4.2"
|
||||
|
||||
- it: KeyValue int should pass
|
||||
set:
|
||||
controllers.main.containers.main.env:
|
||||
string: 1
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].env[0]
|
||||
value:
|
||||
name: string
|
||||
value: "1"
|
||||
|
||||
- it: List should pass
|
||||
set:
|
||||
controllers.main.containers.main.env:
|
||||
- name: STATIC_ENV_FROM_LIST
|
||||
value: STATIC_ENV_VALUE_FROM_LIST
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].env[0]
|
||||
value:
|
||||
name: STATIC_ENV_FROM_LIST
|
||||
value: STATIC_ENV_VALUE_FROM_LIST
|
||||
|
||||
- it: Explicit ValueFrom in list should pass
|
||||
set:
|
||||
controllers.main.containers.main.env:
|
||||
- name: DYNAMIC_ENV_FROM_LIST
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].env[0]
|
||||
value:
|
||||
name: DYNAMIC_ENV_FROM_LIST
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
|
||||
- it: Implicit ValueFrom should pass
|
||||
set:
|
||||
controllers.main.containers.main.env:
|
||||
DYNAMIC_ENV:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].env[0]
|
||||
value:
|
||||
name: DYNAMIC_ENV
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
|
||||
- it: Templated value should pass
|
||||
set:
|
||||
controllers.main.containers.main.env:
|
||||
DYNAMIC_ENV: "{{ .Release.Name }}-admin"
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].env[0]
|
||||
value:
|
||||
name: DYNAMIC_ENV
|
||||
value: RELEASE-NAME-admin
|
||||
|
||||
- it: Combined KeyValue with Explicit ValueFrom should pass
|
||||
set:
|
||||
controllers.main.containers.main.env:
|
||||
STATIC_ENV: static
|
||||
DYNAMIC_ENV:
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].env[0]
|
||||
value:
|
||||
name: DYNAMIC_ENV
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].env[1]
|
||||
value:
|
||||
name: STATIC_ENV
|
||||
value: static
|
28
charts/library/common-test/tests/container/envfrom_test.yaml
Normal file
28
charts/library/common-test/tests/container/envfrom_test.yaml
Normal file
|
@ -0,0 +1,28 @@
|
|||
suite: container envFrom values
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
isNull:
|
||||
path: spec.template.spec.containers[0].envFrom
|
||||
|
||||
- it: explicit envFrom should pass
|
||||
set:
|
||||
controllers.main.containers.main.envFrom:
|
||||
- secretRef:
|
||||
name: myCustomSecret
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].envFrom[0]
|
||||
value:
|
||||
secretRef:
|
||||
name: myCustomSecret
|
31
charts/library/common-test/tests/container/image_test.yaml
Normal file
31
charts/library/common-test/tests/container/image_test.yaml
Normal file
|
@ -0,0 +1,31 @@
|
|||
suite: container image tag
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: string tag should pass
|
||||
set:
|
||||
controllers.main.containers.main.image:
|
||||
repository: ghcr.io/mendhak/http-https-echo
|
||||
tag: latest
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].image
|
||||
value: ghcr.io/mendhak/http-https-echo:latest
|
||||
|
||||
- it: integer tag should pass
|
||||
set:
|
||||
controllers.main.containers.main.image:
|
||||
repository: ghcr.io/mendhak/http-https-echo
|
||||
tag: 1.23
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].image
|
||||
value: ghcr.io/mendhak/http-https-echo:1.23
|
53
charts/library/common-test/tests/container/name_test.yaml
Normal file
53
charts/library/common-test/tests/container/name_test.yaml
Normal file
|
@ -0,0 +1,53 @@
|
|||
suite: container name
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: with explicit name should pass
|
||||
set:
|
||||
controllers.main.containers:
|
||||
main:
|
||||
nameOverride: template-test
|
||||
controller: main
|
||||
image:
|
||||
repository: ghcr.io/mendhak/http-https-echo
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].name
|
||||
value: template-test
|
||||
|
||||
- it: with implicit name should pass
|
||||
set:
|
||||
controllers.main.containers:
|
||||
main:
|
||||
controller: main
|
||||
image:
|
||||
repository: ghcr.io/mendhak/http-https-echo
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].name
|
||||
value: main
|
||||
|
||||
- it: with templated name should pass
|
||||
set:
|
||||
controllers.main.containers:
|
||||
main:
|
||||
nameOverride: "{{ .Release.Name }}-container"
|
||||
controller: main
|
||||
image:
|
||||
repository: ghcr.io/mendhak/http-https-echo
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].name
|
||||
value: RELEASE-NAME-container
|
35
charts/library/common-test/tests/container/ports_test.yaml
Normal file
35
charts/library/common-test/tests/container/ports_test.yaml
Normal file
|
@ -0,0 +1,35 @@
|
|||
suite: container ports
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
isNull:
|
||||
path: spec.template.spec.containers[0].ports
|
||||
|
||||
- it: custom port should pass
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
containers:
|
||||
main:
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: http
|
||||
protocol: TCP
|
||||
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].ports[0]
|
||||
value:
|
||||
containerPort: 8080
|
||||
name: http
|
||||
protocol: TCP
|
468
charts/library/common-test/tests/container/probes_test.yaml
Normal file
468
charts/library/common-test/tests/container/probes_test.yaml
Normal file
|
@ -0,0 +1,468 @@
|
|||
suite: container probes
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
enabled: true
|
||||
port: &port 80
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
tcpSocket:
|
||||
port: *port
|
||||
timeoutSeconds: 1
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].readinessProbe
|
||||
value:
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
tcpSocket:
|
||||
port: *port
|
||||
timeoutSeconds: 1
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].startupProbe
|
||||
value:
|
||||
failureThreshold: 30
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 5
|
||||
tcpSocket:
|
||||
port: *port
|
||||
timeoutSeconds: 1
|
||||
|
||||
- it: custom primary port should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
enabled: true
|
||||
port: 80
|
||||
test:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: &port 8080
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
tcpSocket:
|
||||
port: *port
|
||||
timeoutSeconds: 1
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].readinessProbe
|
||||
value:
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
tcpSocket:
|
||||
port: *port
|
||||
timeoutSeconds: 1
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].startupProbe
|
||||
value:
|
||||
failureThreshold: 30
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 5
|
||||
tcpSocket:
|
||||
port: *port
|
||||
timeoutSeconds: 1
|
||||
|
||||
- it: default with string Service port should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
enabled: true
|
||||
port: "80"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
tcpSocket:
|
||||
port: 80
|
||||
timeoutSeconds: 1
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].readinessProbe
|
||||
value:
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
tcpSocket:
|
||||
port: 80
|
||||
timeoutSeconds: 1
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].startupProbe
|
||||
value:
|
||||
failureThreshold: 30
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 5
|
||||
tcpSocket:
|
||||
port: 80
|
||||
timeoutSeconds: 1
|
||||
|
||||
- it: disabled service should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: false
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
isNull:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
- documentIndex: 0
|
||||
isNull:
|
||||
path: spec.template.spec.containers[0].readinessProbe
|
||||
- documentIndex: 0
|
||||
isNull:
|
||||
path: spec.template.spec.containers[0].startupProbe
|
||||
|
||||
- it: AUTO type probe should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
port: &port 80
|
||||
|
||||
controllers.main.containers.main.probes:
|
||||
liveness:
|
||||
enabled: true
|
||||
type: AUTO
|
||||
path: /api/version
|
||||
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /api/version
|
||||
port: *port
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 1
|
||||
failureThreshold: 3
|
||||
|
||||
- it: HTTP type probe should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
port: &port 80
|
||||
|
||||
controllers.main.containers.main.probes:
|
||||
liveness:
|
||||
enabled: true
|
||||
type: HTTP
|
||||
path: /api/version
|
||||
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /api/version
|
||||
port: *port
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 1
|
||||
failureThreshold: 3
|
||||
|
||||
- it: HTTPS type probe should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
port: &port 80
|
||||
|
||||
controllers.main.containers.main.probes:
|
||||
liveness:
|
||||
enabled: true
|
||||
type: HTTPS
|
||||
path: /api/version
|
||||
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /api/version
|
||||
port: *port
|
||||
scheme: HTTPS
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 1
|
||||
failureThreshold: 3
|
||||
|
||||
- it: custom liveness probe should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
port: &port 80
|
||||
|
||||
controllers.main.containers.main.probes:
|
||||
liveness:
|
||||
enabled: true
|
||||
custom: true
|
||||
spec:
|
||||
httpGet:
|
||||
path: /api/version
|
||||
port: *port
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 1
|
||||
failureThreshold: 3
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /api/version
|
||||
port: *port
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 1
|
||||
failureThreshold: 3
|
||||
|
||||
- it: custom readiness probe should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
port: &port 80
|
||||
|
||||
controllers.main.containers.main.probes:
|
||||
readiness:
|
||||
enabled: true
|
||||
custom: true
|
||||
spec:
|
||||
httpGet:
|
||||
path: /api/version
|
||||
port: *port
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 1
|
||||
failureThreshold: 3
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].readinessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /api/version
|
||||
port: *port
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 1
|
||||
failureThreshold: 3
|
||||
|
||||
- it: custom startup probe should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
port: &port 80
|
||||
|
||||
controllers.main.containers.main.probes:
|
||||
startup:
|
||||
enabled: true
|
||||
custom: true
|
||||
spec:
|
||||
httpGet:
|
||||
path: /api/version
|
||||
port: *port
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 1
|
||||
failureThreshold: 3
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].startupProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /api/version
|
||||
port: *port
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 1
|
||||
failureThreshold: 3
|
||||
|
||||
- it: User-defined liveness probe port should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
port: &port 80
|
||||
|
||||
controllers.main.containers.main.probes:
|
||||
liveness:
|
||||
enabled: true
|
||||
port: &port http
|
||||
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
tcpSocket:
|
||||
port: *port
|
||||
timeoutSeconds: 1
|
||||
|
||||
- it: User-defined liveness probe port should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
port: &port 80
|
||||
|
||||
controllers.main.containers.main.probes:
|
||||
liveness:
|
||||
enabled: true
|
||||
port: &port http
|
||||
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
tcpSocket:
|
||||
port: *port
|
||||
timeoutSeconds: 1
|
||||
|
||||
- it: User-defined readiness probe port should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
port: &port 80
|
||||
|
||||
controllers.main.containers.main.probes:
|
||||
readiness:
|
||||
enabled: true
|
||||
port: &port http
|
||||
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].readinessProbe
|
||||
value:
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
tcpSocket:
|
||||
port: *port
|
||||
timeoutSeconds: 1
|
||||
|
||||
- it: User-defined startup probe port should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
port: &port 80
|
||||
|
||||
controllers.main.containers.main.probes:
|
||||
startup:
|
||||
enabled: true
|
||||
port: &port http
|
||||
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].startupProbe
|
||||
value:
|
||||
failureThreshold: 30
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 5
|
||||
tcpSocket:
|
||||
port: *port
|
||||
timeoutSeconds: 1
|
|
@ -0,0 +1,169 @@
|
|||
suite: container volumeMounts
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: no persistence should pass
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
isNull:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
|
||||
- it: default should pass
|
||||
set:
|
||||
persistence:
|
||||
config:
|
||||
enabled: true
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 1
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0]
|
||||
value:
|
||||
name: config
|
||||
mountPath: /config
|
||||
|
||||
- it: advanced mount config should pass
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
containers:
|
||||
second-container:
|
||||
image:
|
||||
repository: ghcr.io/mendhak/http-https-echo
|
||||
tag: 29
|
||||
|
||||
persistence:
|
||||
data:
|
||||
type: configMap
|
||||
name: myConfigMap
|
||||
advancedMounts:
|
||||
main:
|
||||
main:
|
||||
- path: /data/config.yaml
|
||||
readOnly: false
|
||||
subPath: config.yaml
|
||||
second-container:
|
||||
- path: /appdata/config
|
||||
readOnly: true
|
||||
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0]
|
||||
value:
|
||||
name: data
|
||||
mountPath: /data/config.yaml
|
||||
subPath: config.yaml
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[1].volumeMounts[0]
|
||||
value:
|
||||
name: data
|
||||
mountPath: /appdata/config
|
||||
readOnly: true
|
||||
|
||||
- it: emptyDir should pass
|
||||
set:
|
||||
persistence:
|
||||
cache:
|
||||
type: emptyDir
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0]
|
||||
value:
|
||||
name: cache
|
||||
mountPath: /cache
|
||||
|
||||
- it: custom mountPath should pass
|
||||
set:
|
||||
persistence:
|
||||
config:
|
||||
enabled: true
|
||||
accessMode: ReadWriteMany
|
||||
size: 1G
|
||||
globalMounts:
|
||||
- path: /custom
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 1
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0]
|
||||
value:
|
||||
name: config
|
||||
mountPath: /custom
|
||||
|
||||
- it: mount with subPath should pass
|
||||
set:
|
||||
persistence:
|
||||
config:
|
||||
enabled: true
|
||||
existingClaim: myClaim
|
||||
globalMounts:
|
||||
- path: /config
|
||||
subPath: "mySubPath"
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0]
|
||||
value:
|
||||
name: config
|
||||
mountPath: /config
|
||||
subPath: mySubPath
|
||||
|
||||
- it: hostPath with custom mountPath should pass
|
||||
set:
|
||||
persistence:
|
||||
config:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: /tmp
|
||||
globalMounts:
|
||||
- path: /data
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0]
|
||||
value:
|
||||
name: config
|
||||
mountPath: /data
|
||||
|
||||
- it: hostPath mount with subPath should pass
|
||||
set:
|
||||
persistence:
|
||||
config:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: /dev
|
||||
globalMounts:
|
||||
- subPath: mySubPath
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0]
|
||||
value:
|
||||
name: config
|
||||
mountPath: /dev
|
||||
subPath: mySubPath
|
|
@ -0,0 +1,78 @@
|
|||
suite: cronjob configuration
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default cronjob configuration should pass
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: cronjob
|
||||
asserts:
|
||||
- documentIndex: &ControllerDoc 0
|
||||
isKind:
|
||||
of: CronJob
|
||||
- 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
|
||||
isNull:
|
||||
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:
|
||||
schedule: &CronJobSchedule "0 3 * * *"
|
||||
concurrencyPolicy: &CronJobConcurrencyPolicy "Test"
|
||||
failedJobsHistory: &CronJobFailedJobsHistory 2
|
||||
successfulJobsHistory: &CronJobSuccessfulJobsHistory 3
|
||||
ttlSecondsAfterFinished: &ttlSecondsAfterFinished 3600
|
||||
asserts:
|
||||
- documentIndex: &ControllerDoc 0
|
||||
isKind:
|
||||
of: CronJob
|
||||
- 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
|
|
@ -0,0 +1,116 @@
|
|||
suite: controller metadata cronjob
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
set:
|
||||
controllers.main.type: cronjob
|
||||
asserts:
|
||||
- documentIndex: &ControllerDoc 0
|
||||
isKind:
|
||||
of: CronJob
|
||||
- documentIndex: *ControllerDoc
|
||||
isNull:
|
||||
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
|
|
@ -0,0 +1,88 @@
|
|||
suite: controller metadata daemonset
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
set:
|
||||
controllers.main.type: daemonset
|
||||
asserts:
|
||||
- documentIndex: &ControllerDoc 0
|
||||
isKind:
|
||||
of: DaemonSet
|
||||
- documentIndex: *ControllerDoc
|
||||
isNull:
|
||||
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
|
|
@ -0,0 +1,88 @@
|
|||
suite: controller metadata deployment
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
set:
|
||||
controllers.main.type: deployment
|
||||
asserts:
|
||||
- documentIndex: &ControllerDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *ControllerDoc
|
||||
isNull:
|
||||
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
|
|
@ -0,0 +1,88 @@
|
|||
suite: controller metadata statefulset
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
set:
|
||||
controllers.main.type: statefulset
|
||||
asserts:
|
||||
- documentIndex: &ControllerDoc 0
|
||||
isKind:
|
||||
of: StatefulSet
|
||||
- documentIndex: *ControllerDoc
|
||||
isNull:
|
||||
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
|
68
charts/library/common-test/tests/controller/type_test.yaml
Normal file
68
charts/library/common-test/tests/controller/type_test.yaml
Normal file
|
@ -0,0 +1,68 @@
|
|||
suite: controller types
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- documentIndex: &ControllerDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *ControllerDoc
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME
|
||||
|
||||
- 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
|
||||
|
||||
- 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
|
||||
|
||||
- it: cronjob should pass
|
||||
set:
|
||||
controllers.main.type: cronjob
|
||||
asserts:
|
||||
- documentIndex: &ControllerDoc 0
|
||||
isKind:
|
||||
of: CronJob
|
||||
- documentIndex: *ControllerDoc
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME
|
||||
|
||||
- it: disabled should pass
|
||||
set:
|
||||
controllers.main.enabled: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- documentIndex: &ControllerDoc 0
|
||||
not: true
|
||||
isKind:
|
||||
of: StatefulSet
|
||||
- documentIndex: *ControllerDoc
|
||||
not: true
|
||||
isKind:
|
||||
of: DaemonSet
|
||||
- documentIndex: *ControllerDoc
|
||||
not: true
|
||||
isKind:
|
||||
of: Controller
|
83
charts/library/common-test/tests/ingress/metadata_test.yaml
Normal file
83
charts/library/common-test/tests/ingress/metadata_test.yaml
Normal file
|
@ -0,0 +1,83 @@
|
|||
suite: ingress metadata
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
set:
|
||||
ingress.main.enabled: true
|
||||
asserts:
|
||||
- documentIndex: &IngressDocument 2
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: *IngressDocument
|
||||
isNull:
|
||||
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:
|
||||
enabled: true
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
asserts:
|
||||
- documentIndex: &IngressDocument 2
|
||||
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:
|
||||
enabled: true
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
asserts:
|
||||
- documentIndex: &IngressDocument 2
|
||||
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
|
71
charts/library/common-test/tests/ingress/presence_test.yaml
Normal file
71
charts/library/common-test/tests/ingress/presence_test.yaml
Normal file
|
@ -0,0 +1,71 @@
|
|||
suite: ingress presence
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: 1
|
||||
not: true
|
||||
isKind:
|
||||
of: Ingress
|
||||
|
||||
- it: explicitly disabled should pass
|
||||
set:
|
||||
ingress.main.enabled: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: 1
|
||||
not: true
|
||||
isKind:
|
||||
of: Ingress
|
||||
|
||||
- it: explicitly enabled should pass
|
||||
set:
|
||||
ingress.main.enabled: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: 1
|
||||
not: true
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: 2
|
||||
isKind:
|
||||
of: Ingress
|
||||
|
||||
- it: multiple enabled should pass
|
||||
set:
|
||||
ingress.main.enabled: true
|
||||
ingress.test.enabled: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: 1
|
||||
not: true
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: 2
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: 3
|
||||
isKind:
|
||||
of: Ingress
|
|
@ -0,0 +1,43 @@
|
|||
suite: ingress service reference
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
set:
|
||||
ingress.main.enabled: true
|
||||
asserts:
|
||||
- documentIndex: &IngressDocument 2
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: *IngressDocument
|
||||
equal:
|
||||
path: spec.rules[0].http.paths[0].backend
|
||||
value:
|
||||
service:
|
||||
name: RELEASE-NAME
|
||||
port:
|
||||
number: 8080
|
||||
|
||||
- it: custom service reference should pass
|
||||
set:
|
||||
ingress.main:
|
||||
enabled: true
|
||||
hosts:
|
||||
- host: chart-test.local
|
||||
paths:
|
||||
- path: /
|
||||
service:
|
||||
name: pathService
|
||||
port: 1234
|
||||
asserts:
|
||||
- documentIndex: &IngressDocument 2
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: *IngressDocument
|
||||
equal:
|
||||
path: spec.rules[0].http.paths[0].backend
|
||||
value:
|
||||
service:
|
||||
name: pathService
|
||||
port:
|
||||
number: 1234
|
91
charts/library/common-test/tests/ingress/tls_test.yaml
Normal file
91
charts/library/common-test/tests/ingress/tls_test.yaml
Normal file
|
@ -0,0 +1,91 @@
|
|||
suite: ingress tls
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
set:
|
||||
ingress.main.enabled: true
|
||||
asserts:
|
||||
- documentIndex: &IngressDocument 2
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: *IngressDocument
|
||||
isNull:
|
||||
path: spec.tls
|
||||
|
||||
- it: tls enabled should pass
|
||||
set:
|
||||
ingress.main:
|
||||
enabled: true
|
||||
tls:
|
||||
- secretName: test
|
||||
hosts:
|
||||
- hostname
|
||||
asserts:
|
||||
- documentIndex: &IngressDocument 2
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: *IngressDocument
|
||||
equal:
|
||||
path: spec.tls[0]
|
||||
value:
|
||||
secretName: test
|
||||
hosts:
|
||||
- hostname
|
||||
|
||||
- it: tls enabled without secret should pass
|
||||
set:
|
||||
ingress.main:
|
||||
enabled: true
|
||||
tls:
|
||||
- hosts:
|
||||
- hostname
|
||||
asserts:
|
||||
- documentIndex: &IngressDocument 2
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: *IngressDocument
|
||||
equal:
|
||||
path: spec.tls[0]
|
||||
value:
|
||||
hosts:
|
||||
- hostname
|
||||
|
||||
- it: tls enabled with secret template should pass
|
||||
set:
|
||||
ingress.main:
|
||||
enabled: true
|
||||
tls:
|
||||
- secretName: "{{ .Release.Name }}-secret"
|
||||
hosts:
|
||||
- hostname
|
||||
asserts:
|
||||
- documentIndex: &IngressDocument 2
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: *IngressDocument
|
||||
equal:
|
||||
path: spec.tls[0]
|
||||
value:
|
||||
secretName: RELEASE-NAME-secret
|
||||
hosts:
|
||||
- hostname
|
||||
|
||||
- it: tls enabled with secret template evaluate empty should pass
|
||||
set:
|
||||
ingress.main:
|
||||
enabled: true
|
||||
tls:
|
||||
- secretName: '{{ "" }}'
|
||||
hosts:
|
||||
- hostname
|
||||
asserts:
|
||||
- documentIndex: &IngressDocument 2
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: *IngressDocument
|
||||
equal:
|
||||
path: spec.tls[0]
|
||||
value:
|
||||
hosts:
|
||||
- hostname
|
77
charts/library/common-test/tests/ingress/values_test.yaml
Normal file
77
charts/library/common-test/tests/ingress/values_test.yaml
Normal file
|
@ -0,0 +1,77 @@
|
|||
suite: ingress values
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
set:
|
||||
ingress.main.enabled: true
|
||||
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: custom host and path should pass
|
||||
set:
|
||||
ingress.main:
|
||||
enabled: true
|
||||
hosts:
|
||||
- host: chart-test.local
|
||||
paths:
|
||||
- path: /test
|
||||
service:
|
||||
name: 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:
|
||||
enabled: true
|
||||
hosts:
|
||||
- host: "{{ .Release.Name }}.hostname"
|
||||
|
||||
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:
|
||||
enabled: true
|
||||
hosts:
|
||||
- host: chart-test.local
|
||||
paths:
|
||||
- path: "/{{ .Release.Name }}.path"
|
||||
service:
|
||||
name: main
|
||||
asserts:
|
||||
- documentIndex: &IngressDocument 2
|
||||
isKind:
|
||||
of: Ingress
|
||||
- documentIndex: *IngressDocument
|
||||
equal:
|
||||
path: spec.rules[0].http.paths[0].path
|
||||
value: "/RELEASE-NAME.path"
|
25
charts/library/common-test/tests/misc/nameoverride_test.yaml
Normal file
25
charts/library/common-test/tests/misc/nameoverride_test.yaml
Normal file
|
@ -0,0 +1,25 @@
|
|||
suite: nameOverride tests
|
||||
templates:
|
||||
- common.yaml
|
||||
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
|
||||
|
||||
- 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
|
|
@ -0,0 +1,90 @@
|
|||
suite: persistence claimnames
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
set:
|
||||
persistence:
|
||||
config:
|
||||
enabled: true
|
||||
asserts:
|
||||
- documentIndex: 1
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 1
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: config
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME-config
|
||||
|
||||
- it: with existingClaim should pass
|
||||
set:
|
||||
persistence:
|
||||
existingClaim:
|
||||
enabled: true
|
||||
existingClaim: myClaim
|
||||
mounts:
|
||||
- controllers:
|
||||
- main
|
||||
mountPath: "/data"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: existingClaim
|
||||
persistentVolumeClaim:
|
||||
claimName: myClaim
|
||||
|
||||
- it: disabled suffix should pass
|
||||
set:
|
||||
persistence:
|
||||
claimWithoutSuffix:
|
||||
enabled: true
|
||||
nameOverride: "-"
|
||||
accessMode: ReadWriteMany
|
||||
size: 1G
|
||||
mounts:
|
||||
- controllers:
|
||||
- main
|
||||
mountPath: "/data"
|
||||
asserts:
|
||||
- documentIndex: 1
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 1
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: claimWithoutSuffix
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME
|
||||
|
||||
- it: custom suffix should pass
|
||||
set:
|
||||
persistence:
|
||||
claimWithNameOverride:
|
||||
enabled: true
|
||||
nameOverride: suffix
|
||||
accessMode: ReadWriteMany
|
||||
size: 1G
|
||||
mounts:
|
||||
- controllers:
|
||||
- main
|
||||
mountPath: "/data"
|
||||
asserts:
|
||||
- documentIndex: 1
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 1
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: claimWithNameOverride
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME-suffix
|
|
@ -0,0 +1,60 @@
|
|||
suite: persistence emptydir
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default emptyDir should pass
|
||||
set:
|
||||
persistence:
|
||||
config:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: config
|
||||
emptyDir: {}
|
||||
|
||||
- it: emptyDir with medium should pass
|
||||
set:
|
||||
persistence:
|
||||
config:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
medium: memory
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: config
|
||||
emptyDir:
|
||||
medium: memory
|
||||
|
||||
- it: emptyDir with medium and sizeLimit should pass
|
||||
set:
|
||||
persistence:
|
||||
config:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
medium: memory
|
||||
sizeLimit: 1Gi
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: config
|
||||
emptyDir:
|
||||
medium: memory
|
||||
sizeLimit: 1Gi
|
|
@ -0,0 +1,51 @@
|
|||
suite: persistence hostpath
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: hostPath should pass
|
||||
set:
|
||||
persistence:
|
||||
hostpathmounts-data:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: "/tmp1"
|
||||
mounts:
|
||||
- controllers:
|
||||
- main
|
||||
mountPath: "/data"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: hostpathmounts-data
|
||||
hostPath:
|
||||
path: /tmp1
|
||||
|
||||
- it: hostPath with type should pass
|
||||
set:
|
||||
persistence:
|
||||
hostpathmounts-with-type:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: "/tmp2"
|
||||
hostPathType: "Directory"
|
||||
mounts:
|
||||
- controllers:
|
||||
- main
|
||||
mountPath: "/data2"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: hostpathmounts-with-type
|
||||
hostPath:
|
||||
path: /tmp2
|
||||
type: Directory
|
151
charts/library/common-test/tests/persistence/types_test.yaml
Normal file
151
charts/library/common-test/tests/persistence/types_test.yaml
Normal file
|
@ -0,0 +1,151 @@
|
|||
suite: persistence types
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: custom persistence type should pass
|
||||
set:
|
||||
persistence:
|
||||
custom-mount:
|
||||
enabled: true
|
||||
type: custom
|
||||
volumeSpec:
|
||||
downwardAPI:
|
||||
items:
|
||||
- path: "labels"
|
||||
fieldRef:
|
||||
fieldPath: metadata.labels
|
||||
mounts:
|
||||
- controllers:
|
||||
- main
|
||||
mountPath: "/data"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: custom-mount
|
||||
downwardAPI:
|
||||
items:
|
||||
- fieldRef:
|
||||
fieldPath: metadata.labels
|
||||
path: labels
|
||||
|
||||
- it: configmap persistence type should pass
|
||||
set:
|
||||
persistence:
|
||||
configmap:
|
||||
enabled: true
|
||||
type: configMap
|
||||
name: mySettings
|
||||
mounts:
|
||||
- controllers:
|
||||
- main
|
||||
mountPath: "/data"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: configmap
|
||||
configMap:
|
||||
name: mySettings
|
||||
|
||||
- it: configmap persistence type with name template should pass
|
||||
set:
|
||||
persistence:
|
||||
configmap:
|
||||
enabled: true
|
||||
type: configMap
|
||||
name: '{{ include "bjw-s.common.lib.chart.names.fullname" $ }}-config'
|
||||
mounts:
|
||||
- controllers:
|
||||
- main
|
||||
mountPath: "/data"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: configmap
|
||||
configMap:
|
||||
name: RELEASE-NAME-config
|
||||
|
||||
- it: secret persistence type should pass
|
||||
set:
|
||||
persistence:
|
||||
secret:
|
||||
enabled: true
|
||||
type: secret
|
||||
name: mySettings
|
||||
mounts:
|
||||
- controllers:
|
||||
- main
|
||||
mountPath: "/data"
|
||||
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"
|
||||
mounts:
|
||||
- controllers:
|
||||
- main
|
||||
mountPath: "/data"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: secret
|
||||
secret:
|
||||
secretName: RELEASE-NAME-config
|
||||
|
||||
- it: nfs persistence type should pass
|
||||
set:
|
||||
persistence:
|
||||
nfs:
|
||||
enabled: true
|
||||
type: nfs
|
||||
server: 10.10.0.8
|
||||
path: /tank/nas/library
|
||||
mounts:
|
||||
- controllers:
|
||||
- main
|
||||
mountPath: "/data"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: nfs
|
||||
nfs:
|
||||
path: /tank/nas/library
|
||||
server: 10.10.0.8
|
|
@ -0,0 +1,39 @@
|
|||
suite: persistence volumeclaimtemplates
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: volumeClaimTemplates should pass
|
||||
set:
|
||||
controllers.main:
|
||||
type: statefulset
|
||||
statefulset:
|
||||
volumeClaimTemplates:
|
||||
- name: "storage"
|
||||
accessMode: "ReadWriteOnce"
|
||||
size: "10Gi"
|
||||
storageClass: "storage"
|
||||
labels:
|
||||
test: "label"
|
||||
annotations:
|
||||
test: "annotation"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: StatefulSet
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.volumeClaimTemplates[0]
|
||||
value:
|
||||
metadata:
|
||||
name: storage
|
||||
labels:
|
||||
test: "label"
|
||||
annotations:
|
||||
test: "annotation"
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
storageClassName: storage
|
39
charts/library/common-test/tests/pod/hostIPC_test.yaml
Normal file
39
charts/library/common-test/tests/pod/hostIPC_test.yaml
Normal file
|
@ -0,0 +1,39 @@
|
|||
suite: pod security
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.hostIPC
|
||||
value: false
|
||||
|
||||
- it: hostIPC disabled should pass
|
||||
set:
|
||||
defaultPodOptions:
|
||||
hostIPC: false
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.hostIPC
|
||||
value: false
|
||||
|
||||
- it: hostIPC enabled should pass
|
||||
set:
|
||||
defaultPodOptions:
|
||||
hostIPC: true
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.hostIPC
|
||||
value: true
|
39
charts/library/common-test/tests/pod/hostPID_test.yaml
Normal file
39
charts/library/common-test/tests/pod/hostPID_test.yaml
Normal file
|
@ -0,0 +1,39 @@
|
|||
suite: pod security
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.hostPID
|
||||
value: false
|
||||
|
||||
- it: hostPID disabled should pass
|
||||
set:
|
||||
defaultPodOptions:
|
||||
hostPID: false
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.hostPID
|
||||
value: false
|
||||
|
||||
- it: hostPID enabled should pass
|
||||
set:
|
||||
defaultPodOptions:
|
||||
hostPID: true
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.hostPID
|
||||
value: true
|
|
@ -0,0 +1,43 @@
|
|||
suite: pod initContainers
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: with custom env vars dict should pass
|
||||
set:
|
||||
controllers.main.initContainers:
|
||||
init1:
|
||||
image:
|
||||
repository: ghcr.io/mendhak/http-https-echo
|
||||
env:
|
||||
int: 1
|
||||
float: 1.5
|
||||
string: value_of_env
|
||||
template: "{{ .Release.Name }}-admin"
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDocument 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDocument
|
||||
equal:
|
||||
path: spec.template.spec.initContainers[0].env[0]
|
||||
value:
|
||||
name: float
|
||||
value: "1.5"
|
||||
- documentIndex: *DeploymentDocument
|
||||
equal:
|
||||
path: spec.template.spec.initContainers[0].env[1]
|
||||
value:
|
||||
name: int
|
||||
value: "1"
|
||||
- documentIndex: *DeploymentDocument
|
||||
equal:
|
||||
path: spec.template.spec.initContainers[0].env[2]
|
||||
value:
|
||||
name: string
|
||||
value: value_of_env
|
||||
- documentIndex: *DeploymentDocument
|
||||
equal:
|
||||
path: spec.template.spec.initContainers[0].env[3]
|
||||
value:
|
||||
name: template
|
||||
value: RELEASE-NAME-admin
|
64
charts/library/common-test/tests/pod/network_test.yaml
Normal file
64
charts/library/common-test/tests/pod/network_test.yaml
Normal file
|
@ -0,0 +1,64 @@
|
|||
suite: pod network
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.hostNetwork
|
||||
value: false
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.dnsPolicy
|
||||
value: ClusterFirst
|
||||
|
||||
- it: hostNetwork disabled should pass
|
||||
set:
|
||||
defaultPodOptions:
|
||||
hostNetwork: false
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.hostNetwork
|
||||
value: false
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.dnsPolicy
|
||||
value: ClusterFirst
|
||||
|
||||
- it: hostNetwork enabled should pass
|
||||
set:
|
||||
defaultPodOptions:
|
||||
hostNetwork: true
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.hostNetwork
|
||||
value: true
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.dnsPolicy
|
||||
value: ClusterFirstWithHostNet
|
||||
|
||||
- it: custom dnsPolicy should pass
|
||||
set:
|
||||
defaultPodOptions:
|
||||
dnsPolicy: None
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.dnsPolicy
|
||||
value: None
|
25
charts/library/common-test/tests/pod/replicas_test.yaml
Normal file
25
charts/library/common-test/tests/pod/replicas_test.yaml
Normal file
|
@ -0,0 +1,25 @@
|
|||
suite: pod replicas
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.replicas
|
||||
value: 1
|
||||
|
||||
- it: custom replicas should pass
|
||||
set:
|
||||
controllers.main.replicas: 3
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.replicas
|
||||
value: 3
|
103
charts/library/common-test/tests/pod/sidecars_test.yaml
Normal file
103
charts/library/common-test/tests/pod/sidecars_test.yaml
Normal file
|
@ -0,0 +1,103 @@
|
|||
suite: pod sidecar containers
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: with explicit name should pass
|
||||
set:
|
||||
controllers.main.containers:
|
||||
additional1:
|
||||
nameOverride: template-test
|
||||
image:
|
||||
repository: test
|
||||
tag: test
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].name
|
||||
value: template-test
|
||||
|
||||
- it: with implicit name should pass
|
||||
set:
|
||||
controllers.main.containers:
|
||||
additional1:
|
||||
image:
|
||||
repository: test
|
||||
tag: test
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].name
|
||||
value: additional1
|
||||
|
||||
- it: with templated name should pass
|
||||
set:
|
||||
controllers.main.containers:
|
||||
additional1:
|
||||
nameOverride: "{{ .Release.Name }}-container"
|
||||
image:
|
||||
repository: test
|
||||
tag: test
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].name
|
||||
value: RELEASE-NAME-container
|
||||
|
||||
- it: with custom env vars dict should pass
|
||||
set:
|
||||
controllers.main.containers:
|
||||
main:
|
||||
env:
|
||||
main_env: value
|
||||
additional1:
|
||||
image:
|
||||
repository: test
|
||||
tag: test
|
||||
env:
|
||||
int: 1
|
||||
float: 1.5
|
||||
string: value_of_env
|
||||
template: "{{ .Release.Name }}-admin"
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDocument 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDocument
|
||||
equal:
|
||||
path: spec.template.spec.containers[1].env[0]
|
||||
value:
|
||||
name: main_env
|
||||
value: "value"
|
||||
- documentIndex: *DeploymentDocument
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].env[0]
|
||||
value:
|
||||
name: float
|
||||
value: "1.5"
|
||||
- documentIndex: *DeploymentDocument
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].env[1]
|
||||
value:
|
||||
name: int
|
||||
value: "1"
|
||||
- documentIndex: *DeploymentDocument
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].env[2]
|
||||
value:
|
||||
name: string
|
||||
value: value_of_env
|
||||
- documentIndex: *DeploymentDocument
|
||||
equal:
|
||||
path: spec.template.spec.containers[0].env[3]
|
||||
value:
|
||||
name: template
|
||||
value: RELEASE-NAME-admin
|
106
charts/library/common-test/tests/pvc/metadata_test.yaml
Normal file
106
charts/library/common-test/tests/pvc/metadata_test.yaml
Normal file
|
@ -0,0 +1,106 @@
|
|||
suite: pvc metadata
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
set:
|
||||
persistence.config.enabled: true
|
||||
asserts:
|
||||
- documentIndex: &PersistentVolumeClaimDocument 0
|
||||
isKind:
|
||||
of: PersistentVolumeClaim
|
||||
- documentIndex: *PersistentVolumeClaimDocument
|
||||
isNull:
|
||||
path: metadata.annotations
|
||||
- documentIndex: *PersistentVolumeClaimDocument
|
||||
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: retain enabled should pass
|
||||
set:
|
||||
persistence.config:
|
||||
enabled: true
|
||||
retain: true
|
||||
asserts:
|
||||
- documentIndex: &PersistentVolumeClaimDocument 0
|
||||
isKind:
|
||||
of: PersistentVolumeClaim
|
||||
- documentIndex: *PersistentVolumeClaimDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
helm.sh/resource-policy: keep
|
||||
- documentIndex: *PersistentVolumeClaimDocument
|
||||
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:
|
||||
persistence.config:
|
||||
enabled: true
|
||||
labels:
|
||||
test_label: test
|
||||
annotations:
|
||||
test_annotation: test
|
||||
asserts:
|
||||
- documentIndex: &PersistentVolumeClaimDocument 0
|
||||
isKind:
|
||||
of: PersistentVolumeClaim
|
||||
- documentIndex: *PersistentVolumeClaimDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
test_annotation: test
|
||||
- documentIndex: *PersistentVolumeClaimDocument
|
||||
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
|
||||
persistence.config:
|
||||
enabled: true
|
||||
labels:
|
||||
test_label: test
|
||||
annotations:
|
||||
test_annotation: test
|
||||
asserts:
|
||||
- documentIndex: &PersistentVolumeClaimDocument 0
|
||||
isKind:
|
||||
of: PersistentVolumeClaim
|
||||
- documentIndex: *PersistentVolumeClaimDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
test_annotation: test
|
||||
global_annotation: test
|
||||
- documentIndex: *PersistentVolumeClaimDocument
|
||||
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
|
66
charts/library/common-test/tests/pvc/names_test.yaml
Normal file
66
charts/library/common-test/tests/pvc/names_test.yaml
Normal file
|
@ -0,0 +1,66 @@
|
|||
suite: pvc names
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: disabled should pass
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: PersistentVolumeClaim
|
||||
- documentIndex: 1
|
||||
not: true
|
||||
isKind:
|
||||
of: PersistentVolumeClaim
|
||||
|
||||
- it: default should pass
|
||||
set:
|
||||
persistence.config.enabled: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &PersistentVolumeClaimDocument 0
|
||||
isKind:
|
||||
of: PersistentVolumeClaim
|
||||
- documentIndex: 1
|
||||
not: true
|
||||
isKind:
|
||||
of: PersistentVolumeClaim
|
||||
- documentIndex: 2
|
||||
not: true
|
||||
isKind:
|
||||
of: PersistentVolumeClaim
|
||||
- documentIndex: *PersistentVolumeClaimDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-config
|
||||
|
||||
- it: without suffix should pass
|
||||
set:
|
||||
persistence.config:
|
||||
enabled: true
|
||||
nameOverride: "-"
|
||||
asserts:
|
||||
- documentIndex: &PersistentVolumeClaimDocument 0
|
||||
isKind:
|
||||
of: PersistentVolumeClaim
|
||||
- documentIndex: *PersistentVolumeClaimDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME
|
||||
|
||||
- it: with custom suffix should pass
|
||||
set:
|
||||
persistence.config:
|
||||
enabled: true
|
||||
nameOverride: "custom"
|
||||
asserts:
|
||||
- documentIndex: &PersistentVolumeClaimDocument 0
|
||||
isKind:
|
||||
of: PersistentVolumeClaim
|
||||
- documentIndex: *PersistentVolumeClaimDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-custom
|
42
charts/library/common-test/tests/pvc/storageclass_test.yaml
Normal file
42
charts/library/common-test/tests/pvc/storageclass_test.yaml
Normal file
|
@ -0,0 +1,42 @@
|
|||
suite: pvc storageclass
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
set:
|
||||
persistence.config.enabled: true
|
||||
asserts:
|
||||
- documentIndex: &PersistentVolumeClaimDocument 0
|
||||
isKind:
|
||||
of: PersistentVolumeClaim
|
||||
- documentIndex: *PersistentVolumeClaimDocument
|
||||
isNull:
|
||||
path: spec.storageClassName
|
||||
|
||||
- it: custom should pass
|
||||
set:
|
||||
persistence.config:
|
||||
enabled: true
|
||||
storageClass: custom
|
||||
asserts:
|
||||
- documentIndex: &PersistentVolumeClaimDocument 0
|
||||
isKind:
|
||||
of: PersistentVolumeClaim
|
||||
- documentIndex: *PersistentVolumeClaimDocument
|
||||
equal:
|
||||
path: spec.storageClassName
|
||||
value: custom
|
||||
|
||||
- it: empty should pass
|
||||
set:
|
||||
persistence.config:
|
||||
enabled: true
|
||||
storageClass: "-"
|
||||
asserts:
|
||||
- documentIndex: &PersistentVolumeClaimDocument 0
|
||||
isKind:
|
||||
of: PersistentVolumeClaim
|
||||
- documentIndex: *PersistentVolumeClaimDocument
|
||||
equal:
|
||||
path: spec.storageClassName
|
||||
value: ""
|
93
charts/library/common-test/tests/route/metadata_test.yaml
Normal file
93
charts/library/common-test/tests/route/metadata_test.yaml
Normal file
|
@ -0,0 +1,93 @@
|
|||
suite: route metadata
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
set:
|
||||
route.main:
|
||||
enabled: true
|
||||
parentRefs:
|
||||
- name: test
|
||||
namespace: test
|
||||
asserts:
|
||||
- documentIndex: &routeDocument 2
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: *routeDocument
|
||||
isNull:
|
||||
path: metadata.annotations
|
||||
- documentIndex: *routeDocument
|
||||
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:
|
||||
route.main:
|
||||
enabled: true
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
parentRefs:
|
||||
- name: test
|
||||
namespace: test
|
||||
asserts:
|
||||
- documentIndex: &routeDocument 2
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: *routeDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
test_annotation: test
|
||||
- documentIndex: *routeDocument
|
||||
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
|
||||
route.main:
|
||||
enabled: true
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
parentRefs:
|
||||
- name: test
|
||||
namespace: test
|
||||
asserts:
|
||||
- documentIndex: &routeDocument 2
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: *routeDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
global_annotation: test
|
||||
test_annotation: test
|
||||
- documentIndex: *routeDocument
|
||||
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
|
84
charts/library/common-test/tests/route/presence_test.yaml
Normal file
84
charts/library/common-test/tests/route/presence_test.yaml
Normal file
|
@ -0,0 +1,84 @@
|
|||
suite: route presence
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: 1
|
||||
not: true
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
|
||||
- it: explicitly disabled should pass
|
||||
set:
|
||||
route.main.enabled: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: 1
|
||||
not: true
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
|
||||
- it: explicitly enabled should pass
|
||||
set:
|
||||
route.main:
|
||||
enabled: true
|
||||
parentRefs:
|
||||
- name: test
|
||||
namespace: test
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: 1
|
||||
not: true
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: 2
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
|
||||
- it: multiple enabled should pass
|
||||
set:
|
||||
route:
|
||||
main:
|
||||
enabled: true
|
||||
parentRefs:
|
||||
- name: main
|
||||
namespace: main
|
||||
test:
|
||||
enabled: true
|
||||
parentRefs:
|
||||
- name: test
|
||||
namespace: test
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: 1
|
||||
not: true
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: 2
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: 3
|
||||
isKind:
|
||||
of: HTTPRoute
|
|
@ -0,0 +1,54 @@
|
|||
suite: ingress service reference
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
set:
|
||||
route.main:
|
||||
enabled: true
|
||||
parentRefs:
|
||||
- name: parentName
|
||||
namespace: parentNamespace
|
||||
asserts:
|
||||
- documentIndex: &HTTPRouteDocument 2
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: *HTTPRouteDocument
|
||||
equal:
|
||||
path: spec.rules[0].backendRefs[0]
|
||||
value:
|
||||
group: ""
|
||||
kind: Service
|
||||
name: RELEASE-NAME
|
||||
namespace: NAMESPACE
|
||||
port: 8080
|
||||
weight: 1
|
||||
|
||||
- it: custom service reference should pass
|
||||
set:
|
||||
route.main:
|
||||
enabled: true
|
||||
parentRefs:
|
||||
- name: parentName
|
||||
namespace: parentNamespace
|
||||
rules:
|
||||
- backendRefs:
|
||||
- group: test
|
||||
name: pathService
|
||||
port: 1234
|
||||
namespace: serviceNamespace
|
||||
weight: 123
|
||||
asserts:
|
||||
- documentIndex: &HTTPRouteDocument 2
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: *HTTPRouteDocument
|
||||
equal:
|
||||
path: spec.rules[0].backendRefs[0]
|
||||
value:
|
||||
group: test
|
||||
kind: Service
|
||||
name: pathService
|
||||
namespace: serviceNamespace
|
||||
port: 1234
|
||||
weight: 123
|
212
charts/library/common-test/tests/route/values_test.yaml
Normal file
212
charts/library/common-test/tests/route/values_test.yaml
Normal file
|
@ -0,0 +1,212 @@
|
|||
suite: route values
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: setting gateway should pass
|
||||
set:
|
||||
route.main:
|
||||
enabled: true
|
||||
parentRefs:
|
||||
- name: parentName
|
||||
namespace: parentNamespace
|
||||
asserts:
|
||||
- documentIndex: &HTTPRouteDocument 2
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: *HTTPRouteDocument
|
||||
equal:
|
||||
path: spec.parentRefs[0].name
|
||||
value: parentName
|
||||
- documentIndex: *HTTPRouteDocument
|
||||
equal:
|
||||
path: spec.parentRefs[0].namespace
|
||||
value: parentNamespace
|
||||
|
||||
- it: custom host and path should pass
|
||||
set:
|
||||
route.main:
|
||||
enabled: true
|
||||
parentRefs:
|
||||
- name: parentName
|
||||
namespace: parentNamespace
|
||||
hostnames:
|
||||
- chart-test.local
|
||||
asserts:
|
||||
- documentIndex: &HTTPRouteDocument 2
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: *HTTPRouteDocument
|
||||
equal:
|
||||
path: spec.hostnames[0]
|
||||
value: chart-test.local
|
||||
|
||||
- it: path matches should only be used for HTTPRoutes
|
||||
set:
|
||||
route:
|
||||
main:
|
||||
enabled: true
|
||||
kind: HTTPRoute
|
||||
parentRefs:
|
||||
- name: parentName
|
||||
namespace: parentNamespace
|
||||
rules:
|
||||
- backendRefs:
|
||||
- name: test
|
||||
namespace: test
|
||||
matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /test
|
||||
grpc:
|
||||
enabled: true
|
||||
kind: GRPCRoute
|
||||
parentRefs:
|
||||
- name: parentName
|
||||
namespace: parentNamespace
|
||||
rules:
|
||||
- backendRefs:
|
||||
- name: test
|
||||
namespace: test
|
||||
matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /test
|
||||
tcp:
|
||||
enabled: true
|
||||
kind: TCPRoute
|
||||
parentRefs:
|
||||
- name: parentName
|
||||
namespace: parentNamespace
|
||||
rules:
|
||||
- backendRefs:
|
||||
- name: test
|
||||
namespace: test
|
||||
matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /test
|
||||
tls:
|
||||
enabled: true
|
||||
kind: TLSRoute
|
||||
parentRefs:
|
||||
- name: parentName
|
||||
namespace: parentNamespace
|
||||
rules:
|
||||
- backendRefs:
|
||||
- name: test
|
||||
namespace: test
|
||||
matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /test
|
||||
udp:
|
||||
enabled: true
|
||||
kind: UDPRoute
|
||||
parentRefs:
|
||||
- name: parentName
|
||||
namespace: parentNamespace
|
||||
rules:
|
||||
- backendRefs:
|
||||
- name: test
|
||||
namespace: test
|
||||
matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /test
|
||||
asserts:
|
||||
- documentIndex: &HTTPRouteDocument 2
|
||||
isKind:
|
||||
of: GRPCRoute
|
||||
- documentIndex: &HTTPRouteDocument 2
|
||||
isNull:
|
||||
path: spec.rules[0].matches
|
||||
- documentIndex: &HTTPRouteDocument 3
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: &HTTPRouteDocument 3
|
||||
equal:
|
||||
path: spec.rules[0].matches
|
||||
value:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /test
|
||||
- documentIndex: &HTTPRouteDocument 4
|
||||
isKind:
|
||||
of: TCPRoute
|
||||
- documentIndex: &HTTPRouteDocument 4
|
||||
isNull:
|
||||
path: spec.rules[0].matches
|
||||
- documentIndex: &HTTPRouteDocument 5
|
||||
isKind:
|
||||
of: TLSRoute
|
||||
- documentIndex: &HTTPRouteDocument 5
|
||||
isNull:
|
||||
path: spec.rules[0].matches
|
||||
- documentIndex: &HTTPRouteDocument 6
|
||||
isKind:
|
||||
of: UDPRoute
|
||||
- documentIndex: &HTTPRouteDocument 6
|
||||
isNull:
|
||||
path: spec.rules[0].matches
|
||||
|
||||
- it: hostnames shouldn't be used for TCPRoutes and UDPRoutes
|
||||
set:
|
||||
route:
|
||||
main:
|
||||
enabled: true
|
||||
kind: TCPRoute
|
||||
hostnames:
|
||||
- chart-test.local
|
||||
parentRefs:
|
||||
- name: parentName
|
||||
namespace: parentNamespace
|
||||
udp:
|
||||
enabled: true
|
||||
kind: UDPRoute
|
||||
hostnames:
|
||||
- chart-test.local
|
||||
parentRefs:
|
||||
- name: parentName
|
||||
namespace: parentNamespace
|
||||
asserts:
|
||||
- documentIndex: &HTTPRouteDocument 2
|
||||
isKind:
|
||||
of: TCPRoute
|
||||
- documentIndex: &HTTPRouteDocument 2
|
||||
isNull:
|
||||
path: spec.hostnames
|
||||
- documentIndex: &HTTPRouteDocument 3
|
||||
isKind:
|
||||
of: UDPRoute
|
||||
- documentIndex: &HTTPRouteDocument 3
|
||||
isNull:
|
||||
path: spec.hostnames
|
||||
|
||||
- it: sectionName in parentRefs should be optional
|
||||
set:
|
||||
route:
|
||||
main:
|
||||
enabled: true
|
||||
parentRefs:
|
||||
- name: parentName
|
||||
namespace: parentNamespace
|
||||
second:
|
||||
enabled: true
|
||||
parentRefs:
|
||||
- name: parentName
|
||||
namespace: parentNamespace
|
||||
sectionName: parentSection
|
||||
asserts:
|
||||
- documentIndex: &HTTPRouteDocument 2
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: &HTTPRouteDocument 2
|
||||
isNull:
|
||||
path: spec.parentRefs[0].sectionName
|
||||
- documentIndex: &HTTPRouteDocument 3
|
||||
isKind:
|
||||
of: HTTPRoute
|
||||
- documentIndex: &HTTPRouteDocument 3
|
||||
equal:
|
||||
path: spec.parentRefs[0].sectionName
|
||||
value: parentSection
|
110
charts/library/common-test/tests/secret/metadata_test.yaml
Normal file
110
charts/library/common-test/tests/secret/metadata_test.yaml
Normal file
|
@ -0,0 +1,110 @@
|
|||
suite: secret metadata
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
set:
|
||||
secrets:
|
||||
secret:
|
||||
enabled: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &SecretDocument 2
|
||||
isKind:
|
||||
of: Secret
|
||||
- documentIndex: *SecretDocument
|
||||
isNull:
|
||||
path: metadata.annotations
|
||||
- documentIndex: *SecretDocument
|
||||
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:
|
||||
secrets:
|
||||
secret:
|
||||
enabled: true
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &SecretDocument 2
|
||||
isKind:
|
||||
of: Secret
|
||||
- documentIndex: *SecretDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
test_annotation: test
|
||||
- documentIndex: *SecretDocument
|
||||
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
|
||||
secrets:
|
||||
secret:
|
||||
enabled: true
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &SecretDocument 2
|
||||
isKind:
|
||||
of: Secret
|
||||
- documentIndex: *SecretDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
global_annotation: test
|
||||
test_annotation: test
|
||||
- documentIndex: *SecretDocument
|
||||
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 secret type should pass
|
||||
set:
|
||||
secrets:
|
||||
secret:
|
||||
enabled: true
|
||||
type: &type kubernetes.io/service-account-token
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &SecretDocument 2
|
||||
isKind:
|
||||
of: Secret
|
||||
- documentIndex: *SecretDocument
|
||||
equal:
|
||||
path: type
|
||||
value: *type
|
91
charts/library/common-test/tests/secret/names_test.yaml
Normal file
91
charts/library/common-test/tests/secret/names_test.yaml
Normal file
|
@ -0,0 +1,91 @@
|
|||
suite: secret names
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: Secret
|
||||
- documentIndex: 1
|
||||
not: true
|
||||
isKind:
|
||||
of: Secret
|
||||
|
||||
- it: with disabled secret should pass
|
||||
set:
|
||||
secrets:
|
||||
secret:
|
||||
enabled: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: Secret
|
||||
- documentIndex: 1
|
||||
not: true
|
||||
isKind:
|
||||
of: Secret
|
||||
|
||||
- it: with multiple secrets should pass
|
||||
set:
|
||||
secrets:
|
||||
secret:
|
||||
enabled: true
|
||||
data:
|
||||
foo: bar
|
||||
secondary:
|
||||
enabled: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- documentIndex: &FirstSecretDocument 2
|
||||
isKind:
|
||||
of: Secret
|
||||
- documentIndex: *FirstSecretDocument
|
||||
isNotNull:
|
||||
path: metadata.name
|
||||
- documentIndex: &SecondSecretDocument 3
|
||||
isKind:
|
||||
of: Secret
|
||||
- documentIndex: *SecondSecretDocument
|
||||
isNotNull:
|
||||
path: metadata.name
|
||||
|
||||
- it: default name should pass
|
||||
set:
|
||||
secrets:
|
||||
secret:
|
||||
enabled: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &SecretDocument 2
|
||||
isKind:
|
||||
of: Secret
|
||||
- documentIndex: *SecretDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-secret
|
||||
|
||||
- it: with nameOverride should pass
|
||||
set:
|
||||
secrets:
|
||||
secret:
|
||||
enabled: true
|
||||
nameOverride: http
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &SecretDocument 2
|
||||
isKind:
|
||||
of: Secret
|
||||
- documentIndex: *SecretDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-http
|
|
@ -0,0 +1,25 @@
|
|||
suite: secret Pod metadata
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
set:
|
||||
secrets:
|
||||
secret_1:
|
||||
enabled: true
|
||||
data:
|
||||
test: value 1
|
||||
secret_2:
|
||||
enabled: true
|
||||
data:
|
||||
test_1: value 1
|
||||
test_2: value 2
|
||||
asserts:
|
||||
- documentIndex: &ControllerDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *ControllerDoc
|
||||
equal:
|
||||
path: spec.template.metadata.annotations
|
||||
value:
|
||||
checksum/secrets: 4107837201f46be5279f7accdf3942edabd38f0eb534a61c91d2d7cba7ffc557
|
84
charts/library/common-test/tests/service/metadata_test.yaml
Normal file
84
charts/library/common-test/tests/service/metadata_test.yaml
Normal file
|
@ -0,0 +1,84 @@
|
|||
suite: service metadata
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
isNull:
|
||||
path: metadata.annotations
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: RELEASE-NAME
|
||||
app.kubernetes.io/service: RELEASE-NAME
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
|
||||
- it: custom metadata should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
test_annotation: test
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: RELEASE-NAME
|
||||
app.kubernetes.io/service: 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
|
||||
service:
|
||||
main:
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
global_annotation: test
|
||||
test_annotation: test
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: RELEASE-NAME
|
||||
app.kubernetes.io/service: RELEASE-NAME
|
||||
global_label: test
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
test_label: test
|
29
charts/library/common-test/tests/service/names_test.yaml
Normal file
29
charts/library/common-test/tests/service/names_test.yaml
Normal file
|
@ -0,0 +1,29 @@
|
|||
suite: service names
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME
|
||||
|
||||
- it: custom name suffix should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
nameOverride: http
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-http
|
|
@ -0,0 +1,66 @@
|
|||
suite: service protocols
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0].protocol
|
||||
value: TCP
|
||||
|
||||
- it: explicit TCP should pass
|
||||
set:
|
||||
service.main.ports.http.protocol: TCP
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0].protocol
|
||||
value: TCP
|
||||
|
||||
- it: explicit UDP should pass
|
||||
set:
|
||||
service.main.ports.http.protocol: UDP
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0].protocol
|
||||
value: UDP
|
||||
|
||||
- it: explicit HTTP should pass
|
||||
set:
|
||||
service.main.ports.http.protocol: HTTP
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0].protocol
|
||||
value: TCP
|
||||
- documentIndex: *ServiceDocument
|
||||
isNull:
|
||||
path: metadata.annotations
|
||||
|
||||
- it: explicit HTTPS should pass
|
||||
set:
|
||||
service.main.ports.http.protocol: HTTPS
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0].protocol
|
||||
value: TCP
|
63
charts/library/common-test/tests/service/ports_test.yaml
Normal file
63
charts/library/common-test/tests/service/ports_test.yaml
Normal file
|
@ -0,0 +1,63 @@
|
|||
suite: service ports
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0]
|
||||
value:
|
||||
name: http
|
||||
port: 8080
|
||||
protocol: TCP
|
||||
targetPort: 8080
|
||||
|
||||
- it: custom name should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
enabled: false
|
||||
server:
|
||||
enabled: true
|
||||
port: 8080
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0]
|
||||
value:
|
||||
name: server
|
||||
port: 8080
|
||||
protocol: TCP
|
||||
targetPort: 8080
|
||||
|
||||
- it: custom target port should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
enabled: true
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0]
|
||||
value:
|
||||
name: http
|
||||
port: 8080
|
||||
protocol: TCP
|
||||
targetPort: 80
|
99
charts/library/common-test/tests/service/values_test.yaml
Normal file
99
charts/library/common-test/tests/service/values_test.yaml
Normal file
|
@ -0,0 +1,99 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: service values
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: ports and services are enabled by default
|
||||
set:
|
||||
service:
|
||||
second:
|
||||
type: ClusterIP
|
||||
controller: main
|
||||
ports:
|
||||
first:
|
||||
port: 80
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &FirstServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: &SecondServiceDocument 2
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *FirstServiceDocument
|
||||
notExists:
|
||||
path: spec.allocateLoadBalancerNodePorts
|
||||
|
||||
- it: services can be disabled
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- documentIndex: &DeploymentDocument 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: externalTrafficPolicy should pass for NodePort service
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
externalTrafficPolicy: Local
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.externalTrafficPolicy
|
||||
value: Local
|
||||
|
||||
- it: externalTrafficPolicy should pass for LoadBalancer service
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
externalTrafficPolicy: Local
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.externalTrafficPolicy
|
||||
value: Local
|
||||
|
||||
- it: allocateLoadBalancerNodePorts can be set to true
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
allocateLoadBalancerNodePorts: true
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.allocateLoadBalancerNodePorts
|
||||
value: true
|
||||
|
||||
- it: allocateLoadBalancerNodePorts can be set to false
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
allocateLoadBalancerNodePorts: false
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.allocateLoadBalancerNodePorts
|
||||
value: false
|
|
@ -0,0 +1,105 @@
|
|||
suite: serviceAccount values
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: a serviceAccount is not created by default
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &DeploymentDocument 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
|
||||
- it: a serviceAccount is not created when disabled
|
||||
set:
|
||||
serviceAccount:
|
||||
create: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &DeploymentDocument 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
|
||||
- it: a serviceAccount and Secret are created when enabled
|
||||
set:
|
||||
serviceAccount:
|
||||
create: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- documentIndex: &ServiceAccountDocument 0
|
||||
isKind:
|
||||
of: ServiceAccount
|
||||
- documentIndex: &DeploymentDocument 1
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: &ServiceDocument 2
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: &SecretDocument 3
|
||||
isKind:
|
||||
of: Secret
|
||||
- documentIndex: *ServiceAccountDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: &ServiceAccountName RELEASE-NAME
|
||||
- documentIndex: *ServiceAccountDocument
|
||||
equal:
|
||||
path: secrets
|
||||
value:
|
||||
- name: RELEASE-NAME-sa-token
|
||||
- documentIndex: *DeploymentDocument
|
||||
equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: *ServiceAccountName
|
||||
- documentIndex: *SecretDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
kubernetes.io/service-account.name: RELEASE-NAME
|
||||
|
||||
- it: a serviceAccount and Secret are created with custom name
|
||||
set:
|
||||
serviceAccount:
|
||||
create: true
|
||||
name: &ServiceAccountName myAccount
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- documentIndex: &ServiceAccountDocument 0
|
||||
isKind:
|
||||
of: ServiceAccount
|
||||
- documentIndex: &DeploymentDocument 1
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: &ServiceDocument 2
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: &SecretDocument 3
|
||||
isKind:
|
||||
of: Secret
|
||||
- documentIndex: *ServiceAccountDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: *ServiceAccountName
|
||||
- documentIndex: *ServiceAccountDocument
|
||||
equal:
|
||||
path: secrets
|
||||
value:
|
||||
- name: RELEASE-NAME-sa-token
|
||||
- documentIndex: *DeploymentDocument
|
||||
equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: *ServiceAccountName
|
||||
- documentIndex: *SecretDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
kubernetes.io/service-account.name: *ServiceAccountName
|
|
@ -0,0 +1,151 @@
|
|||
suite: serviceMonitor values
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: a serviceMonitor is not created by default
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &ServiceDocument 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
|
||||
- it: a serviceMonitor is not created when disabled
|
||||
set:
|
||||
serviceMonitor:
|
||||
main:
|
||||
enabled: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &ServiceDocument 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
|
||||
- it: a serviceMonitor is created
|
||||
set:
|
||||
serviceMonitor:
|
||||
main:
|
||||
enabled: true
|
||||
labels:
|
||||
test.label: testvalue
|
||||
endpoints:
|
||||
- port: http
|
||||
scheme: http
|
||||
path: /metrics
|
||||
interval: 1m
|
||||
scrapeTimeout: 10s
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &ServiceMonitorDocument 2
|
||||
isKind:
|
||||
of: ServiceMonitor
|
||||
- documentIndex: *ServiceMonitorDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME
|
||||
- documentIndex: *ServiceMonitorDocument
|
||||
equal:
|
||||
path: spec.selector.matchLabels
|
||||
value:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: RELEASE-NAME
|
||||
app.kubernetes.io/service: RELEASE-NAME
|
||||
- documentIndex: *ServiceMonitorDocument
|
||||
equal:
|
||||
path: spec.endpoints
|
||||
value:
|
||||
- port: http
|
||||
scheme: http
|
||||
path: /metrics
|
||||
interval: 1m
|
||||
scrapeTimeout: 10s
|
||||
- documentIndex: *ServiceMonitorDocument
|
||||
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: testvalue
|
||||
|
||||
- it: a serviceMonitor is created with nameOverride
|
||||
set:
|
||||
serviceMonitor:
|
||||
main:
|
||||
enabled: true
|
||||
nameOverride: test
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &ServiceMonitorDocument 2
|
||||
isKind:
|
||||
of: ServiceMonitor
|
||||
- documentIndex: *ServiceMonitorDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-test
|
||||
- documentIndex: *ServiceMonitorDocument
|
||||
equal:
|
||||
path: spec.selector.matchLabels
|
||||
value:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: RELEASE-NAME
|
||||
app.kubernetes.io/service: RELEASE-NAME
|
||||
|
||||
- it: a serviceMonitor is created with a templated service
|
||||
set:
|
||||
serviceMonitor:
|
||||
main:
|
||||
enabled: true
|
||||
serviceName: "{{ .Release.Name }}"
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &ServiceMonitorDocument 2
|
||||
isKind:
|
||||
of: ServiceMonitor
|
||||
- documentIndex: *ServiceMonitorDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME
|
||||
- documentIndex: *ServiceMonitorDocument
|
||||
equal:
|
||||
path: spec.selector.matchLabels
|
||||
value:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: RELEASE-NAME
|
||||
app.kubernetes.io/service: RELEASE-NAME
|
||||
|
||||
- it: a serviceMonitor is created with a custom selector
|
||||
set:
|
||||
serviceMonitor:
|
||||
main:
|
||||
enabled: true
|
||||
selector:
|
||||
mySelector:
|
||||
test: "true"
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &ServiceMonitorDocument 2
|
||||
isKind:
|
||||
of: ServiceMonitor
|
||||
- documentIndex: *ServiceMonitorDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME
|
||||
- documentIndex: *ServiceMonitorDocument
|
||||
equal:
|
||||
path: spec.selector
|
||||
value:
|
||||
mySelector:
|
||||
test: "true"
|
Loading…
Add table
Add a link
Reference in a new issue