mirror of
https://github.com/truenas/charts.git
synced 2024-04-21 15:21:45 +00:00
some cleanup
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
name: common-test
|
||||
version: 1.0.0
|
||||
apiVersion: v2
|
||||
appVersion: v1.0.0
|
||||
kubeVersion: '>=1.16.0-0'
|
||||
description: A chart for the common library chart-testing
|
||||
home: http://localhost
|
||||
type: application
|
||||
icon: https://localhost/icon
|
||||
dependencies:
|
||||
- name: common
|
||||
repository: file://../common/1.0.0
|
||||
version: ~1.0.0
|
||||
maintainers:
|
||||
- name: truenas
|
||||
url: https://www.truenas.com/
|
||||
@@ -1 +0,0 @@
|
||||
{{ include "ix.v1.common.loader.all" . }}
|
||||
@@ -1,218 +0,0 @@
|
||||
suite: certificate dict test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should fail with empty ixCertificates key
|
||||
set:
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates: {}
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Key <ixCertificates> is empty
|
||||
|
||||
- it: should fail with cert that don't exist
|
||||
set:
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"2":
|
||||
certificate: cert_content
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Certificate (1) was not found.
|
||||
|
||||
- it: should fail with expired cert
|
||||
set:
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
expired: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Certificate (1) is expired
|
||||
|
||||
- it: should fail with revoked cert
|
||||
set:
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
revoked: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Certificate (1) has been revoked
|
||||
|
||||
- it: should pass with 1 secret created with dash in name
|
||||
documentIndex: &secretDoc 0
|
||||
set:
|
||||
scaleCerts:
|
||||
cert-name:
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/tls
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-cert-name-ixcert-1-0
|
||||
- isNotEmpty:
|
||||
path: data.tls\.crt
|
||||
- isNotEmpty:
|
||||
path: data.tls\.key
|
||||
|
||||
- it: should pass with 1 secret created
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts: &basicAssertion
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/tls
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-certname-ixcert-1-0
|
||||
- isNotEmpty:
|
||||
path: data.tls\.crt
|
||||
- isNotEmpty:
|
||||
path: data.tls\.key
|
||||
|
||||
- it: should pass with 1 secret created and revision increased
|
||||
documentIndex: *secretDoc
|
||||
release:
|
||||
revision: 1
|
||||
set:
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/tls
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-certname-ixcert-1-1
|
||||
- isNotEmpty:
|
||||
path: data.tls\.crt
|
||||
- isNotEmpty:
|
||||
path: data.tls\.key
|
||||
|
||||
- it: should pass with 1 secret created and revision increased and name overriden
|
||||
documentIndex: *secretDoc
|
||||
release:
|
||||
revision: 1
|
||||
set:
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
nameOverride: name-override
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/tls
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-name-override-ixcert-1-1
|
||||
- isNotEmpty:
|
||||
path: data.tls\.crt
|
||||
- isNotEmpty:
|
||||
path: data.tls\.key
|
||||
|
||||
- it: should pass with 2 secret created (doc1)
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
certname2:
|
||||
id: 2
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
privatekey: some_key
|
||||
certificate: cert_content
|
||||
"2":
|
||||
privatekey: some_key2
|
||||
certificate: cert_content2
|
||||
asserts: *basicAssertion
|
||||
|
||||
- it: should pass with 2 secret created (doc2)
|
||||
documentIndex: &secretDoc 1
|
||||
set:
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
certname2:
|
||||
id: 2
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
privatekey: some_key
|
||||
certificate: cert_content
|
||||
"2":
|
||||
privatekey: some_key2
|
||||
certificate: cert_content2
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/tls
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-certname2-ixcert-2-0
|
||||
- isNotEmpty:
|
||||
path: data.tls\.crt
|
||||
- isNotEmpty:
|
||||
path: data.tls\.key
|
||||
@@ -1,218 +0,0 @@
|
||||
suite: certificate list test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should fail with empty ixCertificates key
|
||||
set:
|
||||
scaleCertsList:
|
||||
- name: certname
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates: {}
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Key <ixCertificates> is empty
|
||||
|
||||
- it: should fail with cert that don't exist
|
||||
set:
|
||||
scaleCertsList:
|
||||
- name: certname
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"2":
|
||||
certificate: cert_content
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Certificate (1) was not found.
|
||||
|
||||
- it: should fail with expired cert
|
||||
set:
|
||||
scaleCertsList:
|
||||
- name: certname
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
expired: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Certificate (1) is expired
|
||||
|
||||
- it: should fail with revoked cert
|
||||
set:
|
||||
scaleCertsList:
|
||||
- name: certname
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
revoked: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Certificate (1) has been revoked
|
||||
|
||||
- it: should pass with 1 secret created with dash in the name
|
||||
documentIndex: &secretDoc 0
|
||||
set:
|
||||
scaleCertsList:
|
||||
- name: cert-name
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/tls
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-cert-name-ixcert-1-0
|
||||
- isNotEmpty:
|
||||
path: data.tls\.crt
|
||||
- isNotEmpty:
|
||||
path: data.tls\.key
|
||||
|
||||
- it: should pass with 1 secret created
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
scaleCertsList:
|
||||
- name: certname
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts: &basicAssertion
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/tls
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-certname-ixcert-1-0
|
||||
- isNotEmpty:
|
||||
path: data.tls\.crt
|
||||
- isNotEmpty:
|
||||
path: data.tls\.key
|
||||
|
||||
- it: should pass with 1 secret created and revision increased
|
||||
documentIndex: *secretDoc
|
||||
release:
|
||||
revision: 1
|
||||
set:
|
||||
scaleCertsList:
|
||||
- name: certname
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/tls
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-certname-ixcert-1-1
|
||||
- isNotEmpty:
|
||||
path: data.tls\.crt
|
||||
- isNotEmpty:
|
||||
path: data.tls\.key
|
||||
|
||||
- it: should pass with 1 secret created and revision increased and name overriden
|
||||
documentIndex: *secretDoc
|
||||
release:
|
||||
revision: 1
|
||||
set:
|
||||
scaleCertsList:
|
||||
- name: certname
|
||||
id: 1
|
||||
nameOverride: name-override
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/tls
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-name-override-ixcert-1-1
|
||||
- isNotEmpty:
|
||||
path: data.tls\.crt
|
||||
- isNotEmpty:
|
||||
path: data.tls\.key
|
||||
|
||||
- it: should pass with 2 secret created (doc1)
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
scaleCertsList:
|
||||
- name: certname
|
||||
id: 1
|
||||
- name: certname2
|
||||
id: 2
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
privatekey: some_key
|
||||
certificate: cert_content
|
||||
"2":
|
||||
privatekey: some_key2
|
||||
certificate: cert_content2
|
||||
asserts: *basicAssertion
|
||||
|
||||
- it: should pass with 2 secret created (doc2)
|
||||
documentIndex: &secretDoc 1
|
||||
set:
|
||||
scaleCertsList:
|
||||
- name: certname
|
||||
id: 1
|
||||
- name: certname2
|
||||
id: 2
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
privatekey: some_key
|
||||
certificate: cert_content
|
||||
"2":
|
||||
privatekey: some_key2
|
||||
certificate: cert_content2
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/tls
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-certname2-ixcert-2-0
|
||||
- isNotEmpty:
|
||||
path: data.tls\.crt
|
||||
- isNotEmpty:
|
||||
path: data.tls\.key
|
||||
@@ -1,447 +0,0 @@
|
||||
suite: certificate secret mount test
|
||||
templates:
|
||||
- common.yaml
|
||||
release:
|
||||
revision: 2
|
||||
tests:
|
||||
- it: should pass with 1 secret created
|
||||
documentIndex: &secretDoc 0
|
||||
set:
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/tls
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-certname-ixcert-1-2
|
||||
- isNotEmpty:
|
||||
path: data.tls\.crt
|
||||
- isNotEmpty:
|
||||
path: data.tls\.key
|
||||
|
||||
- it: should pass with secret with dash in the name and mounted both certificate and private key
|
||||
documentIndex: &deploymentDoc 1
|
||||
set:
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
scaleCerts:
|
||||
cert-name:
|
||||
id: 1
|
||||
cert:
|
||||
enabled: true
|
||||
path: /some/path/crt.key
|
||||
readOnly: true
|
||||
defaultMode: "0700"
|
||||
key:
|
||||
enabled: true
|
||||
path: /some/path/key.key
|
||||
readOnly: true
|
||||
defaultMode: "0700"
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- matchRegex:
|
||||
path: spec.template.spec.volumes[0].name
|
||||
pattern: &patternCert '^ix-certificate-cert-([0-9]+)-([a-z0-9]){5}$'
|
||||
- equal:
|
||||
path: spec.template.spec.volumes[0].secret
|
||||
value:
|
||||
secretName: RELEASE-NAME-common-test-cert-name-ixcert-1-2
|
||||
defaultMode: 0700
|
||||
- matchRegex:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0].name
|
||||
pattern: *patternCert
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0]
|
||||
content:
|
||||
mountPath: /some/path/crt.key
|
||||
subPath: tls.crt
|
||||
readOnly: true
|
||||
- matchRegex:
|
||||
path: spec.template.spec.volumes[1].name
|
||||
pattern: &patternKey '^ix-certificate-key-([0-9]+)-([a-z0-9]){5}$'
|
||||
- equal:
|
||||
path: spec.template.spec.volumes[1].secret
|
||||
value:
|
||||
secretName: RELEASE-NAME-common-test-cert-name-ixcert-1-2
|
||||
defaultMode: 0700
|
||||
- matchRegex:
|
||||
path: spec.template.spec.containers[0].volumeMounts[1].name
|
||||
pattern: *patternKey
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0].volumeMounts[1]
|
||||
content:
|
||||
mountPath: /some/path/key.key
|
||||
subPath: tls.key
|
||||
readOnly: true
|
||||
|
||||
- it: should pass with mounted secret both certificate and private key
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
cert:
|
||||
enabled: true
|
||||
path: /some/path/crt.key
|
||||
readOnly: true
|
||||
defaultMode: "0700"
|
||||
key:
|
||||
enabled: true
|
||||
path: /some/path/key.key
|
||||
readOnly: true
|
||||
defaultMode: "0700"
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- matchRegex:
|
||||
path: spec.template.spec.volumes[0].name
|
||||
pattern: *patternCert
|
||||
- equal:
|
||||
path: spec.template.spec.volumes[0].secret
|
||||
value:
|
||||
secretName: RELEASE-NAME-common-test-certname-ixcert-1-2
|
||||
defaultMode: 0700
|
||||
- matchRegex:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0].name
|
||||
pattern: *patternCert
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0]
|
||||
content:
|
||||
mountPath: /some/path/crt.key
|
||||
subPath: tls.crt
|
||||
readOnly: true
|
||||
- matchRegex:
|
||||
path: spec.template.spec.volumes[1].name
|
||||
pattern: *patternKey
|
||||
- equal:
|
||||
path: spec.template.spec.volumes[1].secret
|
||||
value:
|
||||
secretName: RELEASE-NAME-common-test-certname-ixcert-1-2
|
||||
defaultMode: 0700
|
||||
- matchRegex:
|
||||
path: spec.template.spec.containers[0].volumeMounts[1].name
|
||||
pattern: *patternKey
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0].volumeMounts[1]
|
||||
content:
|
||||
mountPath: /some/path/key.key
|
||||
subPath: tls.key
|
||||
readOnly: true
|
||||
|
||||
- it: should pass with mounted secret only certificate
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
cert:
|
||||
enabled: true
|
||||
path: /some/path/crt.key
|
||||
readOnly: true
|
||||
defaultMode: "0700"
|
||||
key:
|
||||
enabled: false
|
||||
path: /some/path/key.key
|
||||
readOnly: true
|
||||
defaultMode: "0700"
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- matchRegex:
|
||||
path: spec.template.spec.volumes[0].name
|
||||
pattern: *patternCert
|
||||
- equal:
|
||||
path: spec.template.spec.volumes[0].secret
|
||||
value:
|
||||
secretName: RELEASE-NAME-common-test-certname-ixcert-1-2
|
||||
defaultMode: 0700
|
||||
- matchRegex:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0].name
|
||||
pattern: *patternCert
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0]
|
||||
content:
|
||||
mountPath: /some/path/crt.key
|
||||
subPath: tls.crt
|
||||
readOnly: true
|
||||
|
||||
- it: should pass with mounted secret only private key
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
cert:
|
||||
enabled: false
|
||||
path: /some/path/crt.key
|
||||
readOnly: true
|
||||
defaultMode: "0700"
|
||||
key:
|
||||
enabled: true
|
||||
path: /some/path/key.key
|
||||
readOnly: true
|
||||
defaultMode: "0700"
|
||||
asserts:
|
||||
- matchRegex:
|
||||
path: spec.template.spec.volumes[0].name
|
||||
pattern: *patternKey
|
||||
- equal:
|
||||
path: spec.template.spec.volumes[0].secret
|
||||
value:
|
||||
secretName: RELEASE-NAME-common-test-certname-ixcert-1-2
|
||||
defaultMode: 0700
|
||||
- matchRegex:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0].name
|
||||
pattern: *patternKey
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0]
|
||||
content:
|
||||
mountPath: /some/path/key.key
|
||||
subPath: tls.key
|
||||
readOnly: true
|
||||
|
||||
- it: should pass with 2 mounted secret both certificate and private key
|
||||
documentIndex: &secondDeploymentDoc 2
|
||||
set:
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
"2":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
cert:
|
||||
enabled: true
|
||||
path: /some/path/crt.key
|
||||
readOnly: true
|
||||
defaultMode: "0700"
|
||||
key:
|
||||
enabled: true
|
||||
path: /some/path/key.key
|
||||
readOnly: true
|
||||
defaultMode: "0700"
|
||||
certname2:
|
||||
id: 2
|
||||
cert:
|
||||
enabled: true
|
||||
path: /some/path/crt.key
|
||||
readOnly: true
|
||||
defaultMode: "0700"
|
||||
key:
|
||||
enabled: true
|
||||
path: /some/path/key.key
|
||||
readOnly: true
|
||||
defaultMode: "0700"
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- matchRegex:
|
||||
path: spec.template.spec.volumes[0].name
|
||||
pattern: *patternCert
|
||||
- equal:
|
||||
path: spec.template.spec.volumes[0].secret
|
||||
value:
|
||||
secretName: RELEASE-NAME-common-test-certname-ixcert-1-2
|
||||
defaultMode: 0700
|
||||
- matchRegex:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0].name
|
||||
pattern: *patternCert
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0]
|
||||
content:
|
||||
mountPath: /some/path/crt.key
|
||||
subPath: tls.crt
|
||||
readOnly: true
|
||||
|
||||
- matchRegex:
|
||||
path: spec.template.spec.volumes[1].name
|
||||
pattern: *patternCert
|
||||
- equal:
|
||||
path: spec.template.spec.volumes[1].secret
|
||||
value:
|
||||
secretName: RELEASE-NAME-common-test-certname2-ixcert-2-2
|
||||
defaultMode: 0700
|
||||
- matchRegex:
|
||||
path: spec.template.spec.containers[0].volumeMounts[1].name
|
||||
pattern: *patternCert
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0].volumeMounts[1]
|
||||
content:
|
||||
mountPath: /some/path/crt.key
|
||||
subPath: tls.crt
|
||||
readOnly: true
|
||||
|
||||
- matchRegex:
|
||||
path: spec.template.spec.volumes[2].name
|
||||
pattern: *patternKey
|
||||
- equal:
|
||||
path: spec.template.spec.volumes[2].secret
|
||||
value:
|
||||
secretName: RELEASE-NAME-common-test-certname-ixcert-1-2
|
||||
defaultMode: 0700
|
||||
- matchRegex:
|
||||
path: spec.template.spec.containers[0].volumeMounts[2].name
|
||||
pattern: *patternKey
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0].volumeMounts[2]
|
||||
content:
|
||||
mountPath: /some/path/key.key
|
||||
subPath: tls.key
|
||||
readOnly: true
|
||||
|
||||
- matchRegex:
|
||||
path: spec.template.spec.volumes[3].name
|
||||
pattern: *patternKey
|
||||
- equal:
|
||||
path: spec.template.spec.volumes[3].secret
|
||||
value:
|
||||
secretName: RELEASE-NAME-common-test-certname2-ixcert-2-2
|
||||
defaultMode: 0700
|
||||
- matchRegex:
|
||||
path: spec.template.spec.containers[0].volumeMounts[3].name
|
||||
pattern: *patternKey
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0].volumeMounts[3]
|
||||
content:
|
||||
mountPath: /some/path/key.key
|
||||
subPath: tls.key
|
||||
readOnly: true
|
||||
|
||||
- it: should pass with mounted secret both certificate and private key without extra options
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
cert:
|
||||
enabled: true
|
||||
path: /some/path/crt.key
|
||||
key:
|
||||
enabled: true
|
||||
path: /some/path/key.key
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- matchRegex:
|
||||
path: spec.template.spec.volumes[0].name
|
||||
pattern: *patternCert
|
||||
- equal:
|
||||
path: spec.template.spec.volumes[0].secret
|
||||
value:
|
||||
secretName: RELEASE-NAME-common-test-certname-ixcert-1-2
|
||||
- matchRegex:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0].name
|
||||
pattern: *patternCert
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0]
|
||||
content:
|
||||
mountPath: /some/path/crt.key
|
||||
subPath: tls.crt
|
||||
- matchRegex:
|
||||
path: spec.template.spec.volumes[1].name
|
||||
pattern: *patternKey
|
||||
- equal:
|
||||
path: spec.template.spec.volumes[1].secret
|
||||
value:
|
||||
secretName: RELEASE-NAME-common-test-certname-ixcert-1-2
|
||||
- matchRegex:
|
||||
path: spec.template.spec.containers[0].volumeMounts[1].name
|
||||
pattern: *patternKey
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0].volumeMounts[1]
|
||||
content:
|
||||
mountPath: /some/path/key.key
|
||||
subPath: tls.key
|
||||
|
||||
- it: should pass with mounted secret both certificate and private key without extra options and paths from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
path1: /some/path/crt.key
|
||||
path2: /some/path/key.key
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
cert:
|
||||
enabled: true
|
||||
path: "{{ .Values.path1 }}"
|
||||
key:
|
||||
enabled: true
|
||||
path: "{{ .Values.path2 }}"
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- matchRegex:
|
||||
path: spec.template.spec.volumes[0].name
|
||||
pattern: *patternCert
|
||||
- equal:
|
||||
path: spec.template.spec.volumes[0].secret
|
||||
value:
|
||||
secretName: RELEASE-NAME-common-test-certname-ixcert-1-2
|
||||
- matchRegex:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0].name
|
||||
pattern: *patternCert
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0].volumeMounts[0]
|
||||
content:
|
||||
mountPath: /some/path/crt.key
|
||||
subPath: tls.crt
|
||||
- matchRegex:
|
||||
path: spec.template.spec.volumes[1].name
|
||||
pattern: *patternKey
|
||||
- equal:
|
||||
path: spec.template.spec.volumes[1].secret
|
||||
value:
|
||||
secretName: RELEASE-NAME-common-test-certname-ixcert-1-2
|
||||
- matchRegex:
|
||||
path: spec.template.spec.containers[0].volumeMounts[1].name
|
||||
pattern: *patternKey
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0].volumeMounts[1]
|
||||
content:
|
||||
mountPath: /some/path/key.key
|
||||
subPath: tls.key
|
||||
@@ -1,185 +0,0 @@
|
||||
suite: certificate test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with 1 secret created
|
||||
documentIndex: &secretDoc 0
|
||||
set:
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts: &basicAssertion
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/tls
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-certname-ixcert-1-0
|
||||
- isNotEmpty:
|
||||
path: data.tls\.crt
|
||||
- isNotEmpty:
|
||||
path: data.tls\.key
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
|
||||
- it: should pass with 1 secret created with global labels added
|
||||
documentIndex: &secretDoc 0
|
||||
set:
|
||||
global:
|
||||
labels:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts: &basicAssertion
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
|
||||
- it: should pass with 1 secret created with global labels added from tpl
|
||||
documentIndex: &secretDoc 0
|
||||
set:
|
||||
k1: some_value
|
||||
k2: some_value1
|
||||
global:
|
||||
labels:
|
||||
some_key: "{{ .Values.k1 }}"
|
||||
some_key1: "{{ .Values.k2 }}"
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts: &basicAssertion
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
|
||||
- it: should pass with 1 secret created with global annotations added
|
||||
documentIndex: &secretDoc 0
|
||||
set:
|
||||
global:
|
||||
annotations:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts: &basicAssertion
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
|
||||
- it: should pass with 1 secret created with global annotations added from tpl
|
||||
documentIndex: &secretDoc 0
|
||||
set:
|
||||
k1: some_value
|
||||
k2: some_value1
|
||||
global:
|
||||
annotations:
|
||||
some_key: "{{ .Values.k1 }}"
|
||||
some_key1: "{{ .Values.k2 }}"
|
||||
scaleCerts:
|
||||
certname:
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts: &basicAssertion
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
|
||||
- it: should fail with uppercase in cert name
|
||||
set:
|
||||
scaleCerts:
|
||||
certName:
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Certificate has invalid name (certName). Name must be lowercase.
|
||||
|
||||
- it: should fail with underscore in cert name
|
||||
set:
|
||||
scaleCerts:
|
||||
cert_name:
|
||||
id: 1
|
||||
# Simulating middleware injection
|
||||
ixCertificates:
|
||||
"1":
|
||||
certificate: cert_content
|
||||
privatekey: some_key
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Certificate has invalid name (cert_name). Name cannot contain underscores (_)
|
||||
@@ -1,616 +0,0 @@
|
||||
suite: configmap test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail without a dict in configmap
|
||||
set:
|
||||
configmap:
|
||||
enabled: true
|
||||
content:
|
||||
key: value
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <configmap> key must have at least one dict. Found (bool)
|
||||
|
||||
- it: should fail with uppercase in name in configmap
|
||||
set:
|
||||
configmap:
|
||||
someName:
|
||||
enabled: true
|
||||
content:
|
||||
key: value
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Configmap has invalid name (someName). Name must be lowercase.
|
||||
|
||||
- it: should fail with underscore in name in configmap
|
||||
set:
|
||||
configmap:
|
||||
some_name:
|
||||
enabled: true
|
||||
content:
|
||||
key: value
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Configmap has invalid name (some_name). Name cannot contain underscores (_).
|
||||
|
||||
- it: should fail with empty content in configmap
|
||||
set:
|
||||
configmap:
|
||||
somename:
|
||||
enabled: true
|
||||
content:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Content of Configmap (somename) are empty. Please disable or add content.
|
||||
|
||||
- it: should fail with string in content in configmap
|
||||
set:
|
||||
configmap:
|
||||
somename:
|
||||
enabled: true
|
||||
content: something
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Content of Configmap (somename) are string. Must be in key/value format. Value can be scalar too.
|
||||
|
||||
- it: should pass with 1 configmap created with parseAsEnv set
|
||||
documentIndex: &configMapDoc 0
|
||||
set:
|
||||
configmap:
|
||||
some-name:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
key1: 123
|
||||
key2: value2
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-name
|
||||
- equal:
|
||||
path: data
|
||||
value:
|
||||
key1: "123"
|
||||
key2: value2
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with empty key in content in configmap
|
||||
documentIndex: *configMapDoc
|
||||
set:
|
||||
configmap:
|
||||
somename:
|
||||
enabled: true
|
||||
content:
|
||||
key: ""
|
||||
asserts:
|
||||
- equal:
|
||||
path: data
|
||||
value:
|
||||
key: ""
|
||||
|
||||
- it: should pass with 1 configmap created with parseAsEnv and values set from tpl
|
||||
documentIndex: *configMapDoc
|
||||
set:
|
||||
k1: 123
|
||||
k2: value2
|
||||
configmap:
|
||||
some-name:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
key1: "{{ .Values.k1 }}"
|
||||
key2: "{{ .Values.k2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: data
|
||||
value:
|
||||
key1: "123"
|
||||
key2: value2
|
||||
|
||||
- it: should pass with 1 configmap created with nameOverride set
|
||||
documentIndex: *configMapDoc
|
||||
set:
|
||||
k1: true
|
||||
k2: value2
|
||||
configmap:
|
||||
some-name:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
nameOverride: some-new-name
|
||||
content:
|
||||
key1: "{{ .Values.k1 }}"
|
||||
key2: "{{ .Values.k2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: data
|
||||
value:
|
||||
key1: "true"
|
||||
key2: value2
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-new-name
|
||||
|
||||
- it: should pass with multiple configmap created with parseAsEnv set (1/2) and values from tpl
|
||||
documentIndex: *configMapDoc
|
||||
set:
|
||||
k1: value1
|
||||
k2: false
|
||||
k3: value3
|
||||
k4: value4
|
||||
configmap:
|
||||
some-name:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
key1: "{{ .Values.k1 }}"
|
||||
key2: "{{ .Values.k2 }}"
|
||||
some-other-name:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
key3: "{{ .Values.k3 }}"
|
||||
key4: "{{ .Values.k4 }}"
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-name
|
||||
- equal:
|
||||
path: data
|
||||
value:
|
||||
key1: value1
|
||||
key2: "false"
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with multiple configmap created with parseAsEnv set (2/2) and values from tpl
|
||||
documentIndex: &otherConfigMapDoc 1
|
||||
set:
|
||||
configmap:
|
||||
some-name:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
some-other-name:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
key3: value3
|
||||
key4: value4
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-other-name
|
||||
- equal:
|
||||
path: data
|
||||
value:
|
||||
key3: value3
|
||||
key4: value4
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with multiple configmap created with scalar in contents and tpl (1/2)
|
||||
documentIndex: *configMapDoc
|
||||
set:
|
||||
k1: value1
|
||||
k2: 80
|
||||
k3: pair
|
||||
k4: value2
|
||||
k5: 81
|
||||
k6: false
|
||||
configmap:
|
||||
some-name:
|
||||
enabled: true
|
||||
content:
|
||||
key: "{{ .Values.k3 }}"
|
||||
nginx.conf1: |
|
||||
alias {{ .Values.k1 }}
|
||||
listen {{ .Values.k2 }}
|
||||
|
||||
function {
|
||||
# some json
|
||||
"key": {
|
||||
"key2": "value",
|
||||
"key3": "value2"
|
||||
}
|
||||
}
|
||||
some-other-name:
|
||||
enabled: true
|
||||
content:
|
||||
key: "{{ .Values.k6 }}"
|
||||
nginx.conf2: |
|
||||
alias {{ .Values.k4 }}
|
||||
listen {{ .Values.k5 }}
|
||||
|
||||
function {
|
||||
# some json
|
||||
"key": {
|
||||
"key2": "value",
|
||||
"key3": "value2"
|
||||
}
|
||||
}
|
||||
asserts:
|
||||
- equal:
|
||||
path: data
|
||||
value:
|
||||
key: pair
|
||||
nginx.conf1: |
|
||||
alias value1
|
||||
listen 80
|
||||
|
||||
function {
|
||||
# some json
|
||||
"key": {
|
||||
"key2": "value",
|
||||
"key3": "value2"
|
||||
}
|
||||
}
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-name
|
||||
|
||||
- it: should pass with multiple configmap created with scalar in contents and tpl (2/2)
|
||||
documentIndex: *otherConfigMapDoc
|
||||
set:
|
||||
k1: value1
|
||||
k2: 80
|
||||
k3: pair
|
||||
k4: value2
|
||||
k5: 81
|
||||
k6: false
|
||||
configmap:
|
||||
some-name:
|
||||
enabled: true
|
||||
content:
|
||||
key: "{{ .Values.k3 }}"
|
||||
nginx.conf1: |
|
||||
alias {{ .Values.k1 }}
|
||||
listen {{ .Values.k2 }}
|
||||
|
||||
function {
|
||||
# some json
|
||||
"key": {
|
||||
"key2": "value",
|
||||
"key3": "value2"
|
||||
}
|
||||
}
|
||||
some-other-name:
|
||||
enabled: true
|
||||
content:
|
||||
key: "{{ .Values.k6 }}"
|
||||
nginx.conf2: |
|
||||
alias {{ .Values.k4 }}
|
||||
listen {{ .Values.k5 }}
|
||||
|
||||
function {
|
||||
# some json
|
||||
"key": {
|
||||
"key2": "value",
|
||||
"key3": "value2"
|
||||
}
|
||||
}
|
||||
asserts:
|
||||
- equal:
|
||||
path: data
|
||||
value:
|
||||
key: "false"
|
||||
nginx.conf2: |
|
||||
alias value2
|
||||
listen 81
|
||||
|
||||
function {
|
||||
# some json
|
||||
"key": {
|
||||
"key2": "value",
|
||||
"key3": "value2"
|
||||
}
|
||||
}
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-other-name
|
||||
|
||||
- it: should pass with multiple configmap created and labels and global labels added from tpl (1/2)
|
||||
documentIndex: *configMapDoc
|
||||
set:
|
||||
l1: lab1
|
||||
l2: lab2
|
||||
l5: lab5
|
||||
l6: lab6
|
||||
global:
|
||||
labels:
|
||||
gl1: glab1
|
||||
gl2: glab2
|
||||
configmap:
|
||||
some-name:
|
||||
enabled: true
|
||||
labels:
|
||||
label1: "{{ .Values.l1 }}"
|
||||
label2: "{{ .Values.l2 }}"
|
||||
label3: lab3
|
||||
label4: lab4
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
some-other-name:
|
||||
enabled: true
|
||||
labels:
|
||||
label5: "{{ .Values.l5 }}"
|
||||
label6: "{{ .Values.l6 }}"
|
||||
label7: lab7
|
||||
label8: lab8
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-name
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
label1: lab1
|
||||
label2: lab2
|
||||
label3: lab3
|
||||
label4: lab4
|
||||
gl1: glab1
|
||||
gl2: glab2
|
||||
|
||||
- it: should pass with multiple configmap created and labels and global labels added from tpl (2/2)
|
||||
documentIndex: *otherConfigMapDoc
|
||||
set:
|
||||
l1: lab1
|
||||
l2: lab2
|
||||
l5: lab5
|
||||
l6: lab6
|
||||
global:
|
||||
labels:
|
||||
gl1: glab1
|
||||
gl2: glab2
|
||||
configmap:
|
||||
some-name:
|
||||
enabled: true
|
||||
labels:
|
||||
label1: "{{ .Values.l1 }}"
|
||||
label2: "{{ .Values.l2 }}"
|
||||
label3: lab3
|
||||
label4: lab4
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
some-other-name:
|
||||
enabled: true
|
||||
labels:
|
||||
label5: "{{ .Values.l5 }}"
|
||||
label6: "{{ .Values.l6 }}"
|
||||
label7: lab7
|
||||
label8: lab8
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-other-name
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
label5: lab5
|
||||
label6: lab6
|
||||
label7: lab7
|
||||
label8: lab8
|
||||
gl1: glab1
|
||||
gl2: glab2
|
||||
|
||||
- it: should pass with multiple configmap created and annotations and global annotations added from tpl (1/2)
|
||||
documentIndex: *configMapDoc
|
||||
set:
|
||||
a1: anno1
|
||||
a2: anno2
|
||||
a5: anno5
|
||||
a6: anno6
|
||||
global:
|
||||
annotations:
|
||||
ga1: ganno1
|
||||
ga2: ganno2
|
||||
configmap:
|
||||
some-name:
|
||||
enabled: true
|
||||
annotations:
|
||||
annotation1: "{{ .Values.a1 }}"
|
||||
annotation2: "{{ .Values.a2 }}"
|
||||
annotation3: anno3
|
||||
annotation4: anno4
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
some-other-name:
|
||||
enabled: true
|
||||
annotations:
|
||||
annotation5: "{{ .Values.a5 }}"
|
||||
annotation6: "{{ .Values.a6 }}"
|
||||
annotation7: anno7
|
||||
annotation8: anno8
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
annotation1: anno1
|
||||
annotation2: anno2
|
||||
annotation3: anno3
|
||||
annotation4: anno4
|
||||
ga1: ganno1
|
||||
ga2: ganno2
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-name
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with multiple configmap created and annotations and global annotations added from tpl (2/2)
|
||||
documentIndex: *otherConfigMapDoc
|
||||
set:
|
||||
a1: anno1
|
||||
a2: anno2
|
||||
a5: anno5
|
||||
a6: anno6
|
||||
global:
|
||||
annotations:
|
||||
ga1: ganno1
|
||||
ga2: ganno2
|
||||
configmap:
|
||||
some-name:
|
||||
enabled: true
|
||||
annotations:
|
||||
annotation1: "{{ .Values.a1 }}"
|
||||
annotation2: "{{ .Values.a2 }}"
|
||||
annotation3: anno3
|
||||
annotation4: anno4
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
some-other-name:
|
||||
enabled: true
|
||||
annotations:
|
||||
annotation5: "{{ .Values.a5 }}"
|
||||
annotation6: "{{ .Values.a6 }}"
|
||||
annotation7: anno7
|
||||
annotation8: anno8
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
annotation5: anno5
|
||||
annotation6: anno6
|
||||
annotation7: anno7
|
||||
annotation8: anno8
|
||||
ga1: ganno1
|
||||
ga2: ganno2
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-other-name
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
@@ -1,323 +0,0 @@
|
||||
suite: container in deployment command-arg test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should pass with command set single value
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
command: entrypoint.sh
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].command
|
||||
value:
|
||||
- entrypoint.sh
|
||||
|
||||
- it: should pass with command set single value from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
cmd: entrypoint.sh
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
command: "{{ .Values.cmd }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].command
|
||||
value:
|
||||
- entrypoint.sh
|
||||
|
||||
- it: should pass with command set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
command:
|
||||
- /bin/bash
|
||||
- test
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].command
|
||||
value:
|
||||
- /bin/bash
|
||||
- test
|
||||
|
||||
- it: should pass with command block set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
echo "works!"
|
||||
exit
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].command
|
||||
value:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
echo "works!"
|
||||
exit
|
||||
|
||||
- it: should pass with command set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_key: some_value
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
command:
|
||||
- /bin/bash
|
||||
- "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].command
|
||||
value:
|
||||
- /bin/bash
|
||||
- some_value
|
||||
|
||||
- it: should pass with args set with single value
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
args: --worker
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- --worker
|
||||
|
||||
- it: should pass with args set with single value from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_arg: --worker
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
args: "{{ .Values.some_arg }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- --worker
|
||||
|
||||
- it: should pass with args set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
args:
|
||||
- --port
|
||||
- 8000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- --port
|
||||
- "8000"
|
||||
|
||||
- it: should pass with args set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_port: 9000
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
args:
|
||||
- --port
|
||||
- "{{ .Values.some_port }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- --port
|
||||
- "9000"
|
||||
|
||||
- it: should pass with extraArgs set single value
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
extraArgs: --worker
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- --worker
|
||||
|
||||
- it: should pass with extraArgs set single value from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_extra_arg: --worker
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
extraArgs: "{{ .Values.some_extra_arg }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- --worker
|
||||
|
||||
- it: should pass with extraArgs set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
extraArgs:
|
||||
- --port
|
||||
- 8000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- --port
|
||||
- "8000"
|
||||
|
||||
- it: should pass with extraArgs set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_port: 9000
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
extraArgs:
|
||||
- --port
|
||||
- "{{ .Values.some_port }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- --port
|
||||
- "9000"
|
||||
|
||||
- it: should pass with args and extraArgs set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
args:
|
||||
- --port
|
||||
- 8000
|
||||
extraArgs:
|
||||
- --photos
|
||||
- /photos
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- --port
|
||||
- "8000"
|
||||
- --photos
|
||||
- /photos
|
||||
|
||||
- it: should pass with args and extraArgs set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_port: 9000
|
||||
some_path: /photos
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
args:
|
||||
- --port
|
||||
- "{{ .Values.some_port }}"
|
||||
extraArgs:
|
||||
- --photos
|
||||
- "{{ .Values.some_path }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- --port
|
||||
- "9000"
|
||||
- --photos
|
||||
- /photos
|
||||
|
||||
- it: should pass with args and extraArgs set - single values
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
args: --path
|
||||
extraArgs: /photos
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- --path
|
||||
- /photos
|
||||
|
||||
- it: should pass with args and extraArgs set from tpl - single values
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_arg: --path
|
||||
some_path: /photos
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
args: "{{ .Values.some_arg }}"
|
||||
extraArgs: "{{ .Values.some_path }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].args
|
||||
value:
|
||||
- --path
|
||||
- /photos
|
||||
@@ -1,189 +0,0 @@
|
||||
suite: container in deployment envFrom test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail with envFrom configMapRef has empty name
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: ""
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Name is required for configMapRef in envFrom.
|
||||
|
||||
- it: should fail with envFrom secretRef has empty name
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: ""
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Name is required for secretRef in envFrom.
|
||||
|
||||
- it: should fail with envFrom secretRef has missing name
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envFrom:
|
||||
- secretRef:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Not valid Ref or <name> key is missing in envFrom.
|
||||
|
||||
- it: should fail with envFrom configMapRef has missing name
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Not valid Ref or <name> key is missing in envFrom.
|
||||
|
||||
- it: should fail with envFrom configMapRef and secretRef on the same item
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: something
|
||||
secretRef:
|
||||
name: something
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: You can't define both secretRef and configMapRef on the same item.
|
||||
|
||||
- it: should pass with envFrom configMapRef entry added
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: some_name
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].envFrom
|
||||
value:
|
||||
- configMapRef:
|
||||
name: some_name
|
||||
|
||||
- it: should pass with envFrom configMapRef entries added from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_name: a_name
|
||||
some_name2: a_name2
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: "{{ .Values.some_name }}"
|
||||
- configMapRef:
|
||||
name: "{{ .Values.some_name2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].envFrom
|
||||
value:
|
||||
- configMapRef:
|
||||
name: a_name
|
||||
- configMapRef:
|
||||
name: a_name2
|
||||
|
||||
- it: should pass with envFrom secretRef entry added
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: some_name
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].envFrom
|
||||
value:
|
||||
- secretRef:
|
||||
name: some_name
|
||||
|
||||
- it: should pass with envFrom secretRef entries added from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_name: a_name
|
||||
some_name2: a_name2
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: "{{ .Values.some_name }}"
|
||||
- secretRef:
|
||||
name: "{{ .Values.some_name2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].envFrom
|
||||
value:
|
||||
- secretRef:
|
||||
name: a_name
|
||||
- secretRef:
|
||||
name: a_name2
|
||||
|
||||
- it: should pass with envFrom secretRef and configMapRef entries added from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_name: a_name
|
||||
some_name2: a_name2
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: "{{ .Values.some_name }}"
|
||||
- configMapRef:
|
||||
name: "{{ .Values.some_name2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].envFrom
|
||||
value:
|
||||
- secretRef:
|
||||
name: a_name
|
||||
- configMapRef:
|
||||
name: a_name2
|
||||
@@ -1,223 +0,0 @@
|
||||
suite: container in deployment env list test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail with envList missing name
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envList:
|
||||
- value: some_value
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Please specify both name and value for environment variable
|
||||
|
||||
- it: should fail with envList missing value
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envList:
|
||||
- name: some_name
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Please specify both name and value for environment variable
|
||||
|
||||
- it: should fail with envList name as a map
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envList:
|
||||
- name:
|
||||
some_key: some_value
|
||||
value: some_value
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Name in envList cannot be a map or slice
|
||||
|
||||
- it: should fail with envList name as a slice
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envList:
|
||||
- name:
|
||||
- some_key: some_value
|
||||
value: some_value
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Name in envList cannot be a map or slice
|
||||
|
||||
- it: should fail with envList value as a map
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envList:
|
||||
- name: some_name
|
||||
value:
|
||||
some_key: some_value
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Value in envList cannot be a map or slice
|
||||
|
||||
- it: should fail with envList value as a slice
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envList:
|
||||
- name: some_name
|
||||
value:
|
||||
- some_key: some_value
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Value in envList cannot be a map or slice
|
||||
|
||||
- it: should pass with envList entry added
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envList:
|
||||
- name: some_name
|
||||
value: some_value
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: some_name
|
||||
value: some_value
|
||||
|
||||
- it: should pass with envList entries added
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envList:
|
||||
- name: some_name
|
||||
value: some_value
|
||||
- name: some_name2
|
||||
value: some_value2
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: some_name
|
||||
value: some_value
|
||||
- name: some_name2
|
||||
value: some_value2
|
||||
|
||||
- it: should pass with envList entry added from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_name: a_name
|
||||
some_value: a_value
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envList:
|
||||
- name: "{{ .Values.some_name }}"
|
||||
value: "{{ .Values.some_value }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: a_name
|
||||
value: a_value
|
||||
|
||||
- it: should pass with envList entries added
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_name: a_name
|
||||
some_value: a_value
|
||||
some_name2: a_name2
|
||||
some_value2: a_value2
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envList:
|
||||
- name: "{{ .Values.some_name }}"
|
||||
value: "{{ .Values.some_value }}"
|
||||
- name: "{{ .Values.some_name2 }}"
|
||||
value: "{{ .Values.some_value2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: a_name
|
||||
value: a_value
|
||||
- name: a_name2
|
||||
value: a_value2
|
||||
@@ -1,870 +0,0 @@
|
||||
suite: container in deployment env test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail with envs defined as a list
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
- name: some_name
|
||||
value: some_value
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variables as a list is not supported. Use key-value format.
|
||||
|
||||
- it: should fail with envs defined with an invalid keyRef
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR:
|
||||
invalidKeyRef:
|
||||
name: blabla
|
||||
key: blbla
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Not a valid valueFrom reference. Valid options are (configMapKeyRef and secretKeyRef)
|
||||
|
||||
- it: should fail with envs defined without a name in configMapKeyRef
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR:
|
||||
configMapKeyRef:
|
||||
key: some_key
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <name> for the keyRef is not defined in (ENVVAR)
|
||||
|
||||
- it: should fail with envs defined without a name in secretKeyRef
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR:
|
||||
secretKeyRef:
|
||||
key: some_key
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <name> for the keyRef is not defined in (ENVVAR)
|
||||
|
||||
- it: should fail with envs defined without a key in configMapKeyRef
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR:
|
||||
configMapKeyRef:
|
||||
name: some_name
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <key> for the keyRef is not defined in (ENVVAR)
|
||||
|
||||
- it: should fail with envs defined without a key in secretKeyRef
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR:
|
||||
secretKeyRef:
|
||||
name: some_name
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <key> for the keyRef is not defined in (ENVVAR)
|
||||
|
||||
- it: should fail with envs defined with a non-bool <optional> in secretKeyRef
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR:
|
||||
secretKeyRef:
|
||||
name: some_name
|
||||
key: some_key
|
||||
optional: non-bool
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <optional> in secretKeyRef must be a boolean on Environment Variable (ENVVAR)
|
||||
|
||||
- it: should fail with envs defined with valueFrom key
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR:
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: some_name
|
||||
key: some_key
|
||||
optional: non-bool
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Please remove <valueFrom> and use directly configMapKeyRef or secretKeyRef
|
||||
|
||||
- it: should fail with envs defined with optional in configMapKeyRef
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR:
|
||||
configMapKeyRef:
|
||||
name: some_name
|
||||
key: some_key
|
||||
optional: non-bool
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <optional> is not supported in configMapRefKey
|
||||
|
||||
- it: should fail with env trying to override fixedEnv
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
TZ: something
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (TZ) on container (RELEASE-NAME-common-test) is set more than once. [to (UTC) on (fixedEnv)] and [to (something) on (env)]
|
||||
|
||||
- it: should fail with env trying to override configmap
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR: something
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: '{{ include "ix.v1.common.names.fullname" . }}-somename'
|
||||
configmap:
|
||||
somename:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
ENVVAR: ABC
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (ENVVAR) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (env)] and [to (ABC) on (configmap-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with env trying to override secret
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR: something
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
secret:
|
||||
somename:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
ENVVAR: ABC
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (ENVVAR) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (env)] and [to (ABC) on (secret-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with env trying to override envList
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR: something
|
||||
envList:
|
||||
- name: ENVVAR
|
||||
value: ABC
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (ENVVAR) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (env)] and [to (ABC) on (envList)]
|
||||
|
||||
- it: should fail with envList trying to override fixedEnv
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envList:
|
||||
- name: TZ
|
||||
value: something
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (TZ) on container (RELEASE-NAME-common-test) is set more than once. [to (UTC) on (fixedEnv)] and [to (something) on (envList)]
|
||||
|
||||
- it: should fail with envList trying to override env
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
POSTGRES_HOST: postgres.svc.cluster.local
|
||||
envList:
|
||||
- name: POSTGRES_HOST
|
||||
value: something
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (postgres.svc.cluster.local) on (env)] and [to (something) on (envList)]
|
||||
|
||||
- it: should fail with envList trying to override configmap
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envList:
|
||||
- name: POSTGRES_HOST
|
||||
value: something
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: '{{ include "ix.v1.common.names.fullname" . }}-somename'
|
||||
configmap:
|
||||
somename:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
POSTGRES_HOST: something
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (envList)] and [to (something) on (configmap-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with envList trying to override secret
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envList:
|
||||
- name: POSTGRES_HOST
|
||||
value: something
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
secret:
|
||||
somename:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
POSTGRES_HOST: something
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (envList)] and [to (something) on (secret-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with configmap trying to override fixedEnv
|
||||
set:
|
||||
configmap:
|
||||
somename:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
TZ: something
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: '{{ include "ix.v1.common.names.fullname" . }}-somename'
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (TZ) on container (RELEASE-NAME-common-test) is set more than once. [to (UTC) on (fixedEnv)] and [to (something) on (configmap-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with configmap trying to override env
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
POSTGRES_HOST: postgres.svc.cluster.local
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: '{{ include "ix.v1.common.names.fullname" . }}-somename'
|
||||
configmap:
|
||||
somename:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
POSTGRES_HOST: something
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (postgres.svc.cluster.local) on (env)] and [to (something) on (configmap-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with configmap trying to override envList
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envList:
|
||||
- name: POSTGRES_HOST
|
||||
value: postgres.svc.cluster.local
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: '{{ include "ix.v1.common.names.fullname" . }}-somename'
|
||||
configmap:
|
||||
somename:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
POSTGRES_HOST: something
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (postgres.svc.cluster.local) on (envList)] and [to (something) on (configmap-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with configmap trying to override secret
|
||||
set:
|
||||
secret:
|
||||
somename:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
POSTGRES_HOST: something123
|
||||
configmap:
|
||||
somename:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
POSTGRES_HOST: something
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: '{{ include "ix.v1.common.names.fullname" . }}-somename'
|
||||
- secretRef:
|
||||
name: '{{ include "ix.v1.common.names.fullname" . }}-somename'
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (configmap-RELEASE-NAME-common-test-somename)] and [to (something123) on (secret-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with secret trying to override fixedEnv
|
||||
set:
|
||||
secret:
|
||||
somename:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
TZ: something
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (TZ) on container (RELEASE-NAME-common-test) is set more than once. [to (UTC) on (fixedEnv)] and [to (something) on (secret-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with secret trying to override env
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
POSTGRES_HOST: postgres.svc.cluster.local
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
secret:
|
||||
somename:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
POSTGRES_HOST: something
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (postgres.svc.cluster.local) on (env)] and [to (something) on (secret-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with secret trying to override envList
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envList:
|
||||
- name: POSTGRES_HOST
|
||||
value: postgres.svc.cluster.local
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
secret:
|
||||
somename:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
POSTGRES_HOST: something
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (postgres.svc.cluster.local) on (envList)] and [to (something) on (secret-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with secret trying to override configmap
|
||||
set:
|
||||
configmap:
|
||||
somename:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
POSTGRES_HOST: something123
|
||||
secret:
|
||||
somename:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
POSTGRES_HOST: something
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: '{{ include "ix.v1.common.names.fullname" . }}-somename'
|
||||
- secretRef:
|
||||
name: '{{ include "ix.v1.common.names.fullname" . }}-somename'
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (something123) on (configmap-RELEASE-NAME-common-test-somename)] and [to (something) on (secret-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should pass with envs defined with int value
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR: 123
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: ENVVAR
|
||||
value: "123"
|
||||
|
||||
- it: should pass with envs defined with bool value
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: ENVVAR
|
||||
value: "true"
|
||||
|
||||
- it: should pass with envs defined with string value
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR: "some_value"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: ENVVAR
|
||||
value: "some_value"
|
||||
|
||||
- it: should pass with multiple envs defined via tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_string: a_string
|
||||
some_int: 123
|
||||
some_bool: false
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR: "{{ .Values.some_string }}"
|
||||
ENVVAR2: "{{ .Values.some_int }}"
|
||||
ENVVAR3: "{{ .Values.some_bool }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: ENVVAR
|
||||
value: "a_string"
|
||||
- name: ENVVAR2
|
||||
value: "123"
|
||||
- name: ENVVAR3
|
||||
value: "false"
|
||||
|
||||
- it: should pass with envs defined with valueFrom configMapKeyRef
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR:
|
||||
configMapKeyRef:
|
||||
name: some_name
|
||||
key: some_key
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: ENVVAR
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: some_name
|
||||
key: some_key
|
||||
|
||||
- it: should pass with envs defined with valueFrom secretKeyRef
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR:
|
||||
secretKeyRef:
|
||||
name: some_name
|
||||
key: some_key
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: ENVVAR
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: some_name
|
||||
key: some_key
|
||||
|
||||
- it: should pass with envs defined with valueFrom configMapKeyRef from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
name: some_name
|
||||
key: some_key
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR:
|
||||
configMapKeyRef:
|
||||
name: "{{ .Values.name }}"
|
||||
key: "{{ .Values.key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: ENVVAR
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: some_name
|
||||
key: some_key
|
||||
|
||||
- it: should pass with envs defined with valueFrom secretKeyRef from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
name: some_name
|
||||
key: some_key
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR:
|
||||
secretKeyRef:
|
||||
name: "{{ .Values.name }}"
|
||||
key: "{{ .Values.key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: ENVVAR
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: some_name
|
||||
key: some_key
|
||||
|
||||
- it: should pass with envs defined with valueFrom secretKeyRef with <optional> true
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR:
|
||||
secretKeyRef:
|
||||
name: some_name
|
||||
key: some_key
|
||||
optional: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: ENVVAR
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
optional: true
|
||||
name: some_name
|
||||
key: some_key
|
||||
|
||||
- it: should pass with envs defined with valueFrom secretKeyRef with <optional> false
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR:
|
||||
secretKeyRef:
|
||||
name: some_name
|
||||
key: some_key
|
||||
optional: false
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: ENVVAR
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
optional: false
|
||||
name: some_name
|
||||
key: some_key
|
||||
|
||||
- it: should pass with multiple envs defined with valueFrom configMapKeyRef and secretKeyRef via tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
name: some_name
|
||||
key: some_key
|
||||
name2: some_name2
|
||||
key2: some_key2
|
||||
name3: some_name3
|
||||
key3: some_key3
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR:
|
||||
configMapKeyRef:
|
||||
name: "{{ .Values.name }}"
|
||||
key: "{{ .Values.key }}"
|
||||
ENVVAR2:
|
||||
secretKeyRef:
|
||||
name: "{{ .Values.name2 }}"
|
||||
key: "{{ .Values.key2 }}"
|
||||
optional: false
|
||||
ENVVAR3:
|
||||
secretKeyRef:
|
||||
name: "{{ .Values.name3 }}"
|
||||
key: "{{ .Values.key3 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: ENVVAR
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: some_name
|
||||
key: some_key
|
||||
- name: ENVVAR2
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: some_name2
|
||||
key: some_key2
|
||||
optional: false
|
||||
- name: ENVVAR3
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: some_name3
|
||||
key: some_key3
|
||||
@@ -1,460 +0,0 @@
|
||||
suite: container in deployment fixed env test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail with empty PUID
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
PUID:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <PUID> key cannot be empty. Set a value or remove the key for the default (568) to take effect.
|
||||
|
||||
- it: should fail with PUID not-int
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
PUID: "1000"
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <PUID> key has value of ("1000"). But must be an int.
|
||||
|
||||
- it: should fail with empty UMASK
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
UMASK:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <UMASK> key cannot be empty. Set a value or remove the key for the default (002) to take effect.
|
||||
|
||||
- it: should fail with UMASK not-string
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
UMASK: 2
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <UMASK> key must be a string, so the format is kept intact.
|
||||
|
||||
- it: should pass with injectFixedEnvs false
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
injectFixedEnvs: false
|
||||
asserts:
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].env
|
||||
|
||||
- it: should pass with TZ and UMASK changed
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
TZ: ETC
|
||||
UMASK: "003"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: ETC
|
||||
- name: UMASK
|
||||
value: "003"
|
||||
- name: UMASK_SET
|
||||
value: "003"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
|
||||
- it: should pass with an env referencing TZ and PUID
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
runAsNonRoot: false
|
||||
env:
|
||||
TIMEZONE: "{{ .Values.TZ }}"
|
||||
APP_USER_ID: "{{ .Values.PUID }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: PUID
|
||||
value: "568"
|
||||
- name: USER_ID
|
||||
value: "568"
|
||||
- name: UID
|
||||
value: "568"
|
||||
- name: PGID
|
||||
value: "568"
|
||||
- name: GROUP_ID
|
||||
value: "568"
|
||||
- name: GID
|
||||
value: "568"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: APP_USER_ID
|
||||
value: "568"
|
||||
- name: TIMEZONE
|
||||
value: UTC
|
||||
|
||||
- it: should pass without S6_READ_ONLY_ROOT
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
readOnlyRootFilesystem: false
|
||||
runAsNonRoot: false
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
|
||||
- it: should pass with scaleGPU set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU:
|
||||
gpu.intel.com/i915: "1"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_DRIVER_CAPABILITIES
|
||||
value: all
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
|
||||
- it: should pass with envs changed because run as user root
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
runAsNonRoot: false
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: PUID
|
||||
value: "568"
|
||||
- name: USER_ID
|
||||
value: "568"
|
||||
- name: UID
|
||||
value: "568"
|
||||
- name: PGID
|
||||
value: "568"
|
||||
- name: GROUP_ID
|
||||
value: "568"
|
||||
- name: GID
|
||||
value: "568"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
|
||||
- it: should pass with envs changed because run as group root
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsGroup: 0
|
||||
runAsNonRoot: false
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: PUID
|
||||
value: "568"
|
||||
- name: USER_ID
|
||||
value: "568"
|
||||
- name: UID
|
||||
value: "568"
|
||||
- name: PGID
|
||||
value: "568"
|
||||
- name: GROUP_ID
|
||||
value: "568"
|
||||
- name: GID
|
||||
value: "568"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
|
||||
- it: should pass with envs changed because run as user root and PUID 0
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
runAsNonRoot: false
|
||||
PUID: 0
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: PUID
|
||||
value: "0"
|
||||
- name: USER_ID
|
||||
value: "0"
|
||||
- name: UID
|
||||
value: "0"
|
||||
- name: PGID
|
||||
value: "568"
|
||||
- name: GROUP_ID
|
||||
value: "568"
|
||||
- name: GID
|
||||
value: "568"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
|
||||
- it: should pass with envs changed because run as group root and PUID 0
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsGroup: 0
|
||||
runAsNonRoot: false
|
||||
PUID: 0
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: PUID
|
||||
value: "0"
|
||||
- name: USER_ID
|
||||
value: "0"
|
||||
- name: UID
|
||||
value: "0"
|
||||
- name: PGID
|
||||
value: "568"
|
||||
- name: GROUP_ID
|
||||
value: "568"
|
||||
- name: GID
|
||||
value: "568"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
|
||||
- it: should pass with envs changed because run as group root and fsGroup 0 and PUID 0
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
securityContext:
|
||||
fsGroup: 0
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsGroup: 0
|
||||
runAsNonRoot: false
|
||||
PUID: 0
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: PUID
|
||||
value: "0"
|
||||
- name: USER_ID
|
||||
value: "0"
|
||||
- name: UID
|
||||
value: "0"
|
||||
- name: PGID
|
||||
value: "0"
|
||||
- name: GROUP_ID
|
||||
value: "0"
|
||||
- name: GID
|
||||
value: "0"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
|
||||
- it: should pass with envs defined with scaleGPU
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU:
|
||||
gpu.intel.com/i915: "1"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_DRIVER_CAPABILITIES
|
||||
value: "all"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
|
||||
- it: should fail with non-unique nvidiaCaps
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
nvidiaCaps:
|
||||
- compute
|
||||
- compute
|
||||
- utility
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <nvidiaCaps> ([compute compute utility]) are must have unique values only
|
||||
|
||||
- it: should fail with invalid nvidiaCaps value
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
nvidiaCaps:
|
||||
- invalid
|
||||
- compute
|
||||
- utility
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid options in <nvidiaCaps> (invalid). Valid options are compute, utility, all, graphics, video
|
||||
|
||||
- it: should pass with envs defined with scaleGPU and custom capabilities
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU:
|
||||
gpu.intel.com/i915: "1"
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
nvidiaCaps:
|
||||
- compute
|
||||
- utility
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_DRIVER_CAPABILITIES
|
||||
value: "compute,utility"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
@@ -1,145 +0,0 @@
|
||||
|
||||
suite: container in deployment image test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should pass with imagePullPolicy changed
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
image:
|
||||
pullPolicy: Always
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].imagePullPolicy
|
||||
value: Always
|
||||
|
||||
- it: should pass with image changed
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
image:
|
||||
repository: some_repo
|
||||
tag: some_tag
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].image
|
||||
value: some_repo:some_tag
|
||||
|
||||
- it: should fail without repository
|
||||
set:
|
||||
image:
|
||||
repository: ""
|
||||
tag: some_tag
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Image <repository> is required
|
||||
|
||||
- it: should fail without tag
|
||||
set:
|
||||
image:
|
||||
repository: some_repo
|
||||
tag: ""
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Image <tag> is required
|
||||
|
||||
- it: should fail with invalid pullPolicy
|
||||
set:
|
||||
image:
|
||||
repository: some_repo
|
||||
tag: some_tag
|
||||
pullPolicy: invalid_policy
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid <pullPolicy> option (invalid_policy). Valid options are IfNotPresent, Always, Never
|
||||
|
||||
- it: should fail with selected image that does not exist in values
|
||||
set:
|
||||
imageX:
|
||||
repository: some_repo
|
||||
tag: some_tag
|
||||
pullPolicy: invalid_policy
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: imageY
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Selected image (imageY) does not exist in values
|
||||
|
||||
- it: should pass with image from image selector
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
betaImage:
|
||||
repository: some_other_repo
|
||||
tag: some_other_tag
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: betaImage
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].image
|
||||
value: some_other_repo:some_other_tag
|
||||
|
||||
- it: should pass with pullPolicy from image selector
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
betaImage:
|
||||
repository: some_other_repo
|
||||
tag: some_other_tag
|
||||
pullPolicy: Never
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: betaImage
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].image
|
||||
value: some_other_repo:some_other_tag
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].imagePullPolicy
|
||||
value: Never
|
||||
|
||||
- it: should fail without repo from image selector
|
||||
set:
|
||||
betaImage:
|
||||
repository: ""
|
||||
tag: some_other_tag
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: betaImage
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Image <repository> is required
|
||||
|
||||
- it: should fail without tag from image selector
|
||||
set:
|
||||
betaImage:
|
||||
repository: some_other_repo
|
||||
tag: ""
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: betaImage
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Image <tag> is required
|
||||
@@ -1,258 +0,0 @@
|
||||
|
||||
suite: container in deployment lifecycle test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should pass with single postStart lifecycle set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
lifecycle:
|
||||
postStart:
|
||||
command: some_command
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].lifecycle
|
||||
value:
|
||||
postStart:
|
||||
exec:
|
||||
command:
|
||||
- some_command
|
||||
|
||||
- it: should pass with single postStart lifecycle set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_key: some_command
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
lifecycle:
|
||||
postStart:
|
||||
command: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].lifecycle
|
||||
value:
|
||||
postStart:
|
||||
exec:
|
||||
command:
|
||||
- some_command
|
||||
|
||||
- it: should pass with postStart lifecycle set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
lifecycle:
|
||||
postStart:
|
||||
command:
|
||||
- /bin/bash
|
||||
- test
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].lifecycle
|
||||
value:
|
||||
postStart:
|
||||
exec:
|
||||
command:
|
||||
- /bin/bash
|
||||
- test
|
||||
|
||||
- it: should pass with postStart lifecycle set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_key: some_value
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
lifecycle:
|
||||
postStart:
|
||||
command:
|
||||
- /bin/bash
|
||||
- "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].lifecycle
|
||||
value:
|
||||
postStart:
|
||||
exec:
|
||||
command:
|
||||
- /bin/bash
|
||||
- some_value
|
||||
|
||||
- it: should pass with single preStop lifecycle set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
lifecycle:
|
||||
preStop:
|
||||
command: some_command
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].lifecycle
|
||||
value:
|
||||
preStop:
|
||||
exec:
|
||||
command:
|
||||
- some_command
|
||||
|
||||
- it: should pass with single preStop lifecycle set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_key: some_command
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
lifecycle:
|
||||
preStop:
|
||||
command: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].lifecycle
|
||||
value:
|
||||
preStop:
|
||||
exec:
|
||||
command:
|
||||
- some_command
|
||||
|
||||
- it: should pass with preStop lifecycle set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
lifecycle:
|
||||
preStop:
|
||||
command:
|
||||
- /bin/bash
|
||||
- test
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].lifecycle
|
||||
value:
|
||||
preStop:
|
||||
exec:
|
||||
command:
|
||||
- /bin/bash
|
||||
- test
|
||||
|
||||
- it: should pass with preStop lifecycle set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_key: some_value
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
lifecycle:
|
||||
preStop:
|
||||
command:
|
||||
- /bin/bash
|
||||
- "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].lifecycle
|
||||
value:
|
||||
preStop:
|
||||
exec:
|
||||
command:
|
||||
- /bin/bash
|
||||
- some_value
|
||||
|
||||
- it: should fail with invalid key
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
lifecycle:
|
||||
preStart:
|
||||
command: something
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid key (preStart) in lifecycle. Valid keys are preStop and postStart
|
||||
|
||||
- it: should fail with no command in preStop
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
lifecycle:
|
||||
preStop:
|
||||
command: ""
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: No commands were given for preStop lifecycle hook
|
||||
|
||||
- it: should fail with no command in postStart
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
lifecycle:
|
||||
postStart:
|
||||
command: ""
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: No commands were given for postStart lifecycle hook
|
||||
|
||||
- it: should fail with no command in preStop
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
lifecycle:
|
||||
preStop:
|
||||
command: ""
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: No commands were given for preStop lifecycle hook
|
||||
|
||||
- it: should fail with no command in postStart
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
lifecycle:
|
||||
postStart:
|
||||
command: ""
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: No commands were given for postStart lifecycle hook
|
||||
@@ -1,240 +0,0 @@
|
||||
suite: container in deployment port test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail with named port
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
port: 443
|
||||
targetPort: some_name
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: This common library does not support named ports for targetPort. port name (main), targetPort (some_name)
|
||||
|
||||
- it: should fail without port
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
port:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Port is required on enabled services. Service (main)
|
||||
|
||||
- it: should fail with multiple port, but none set as primary
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
port: 65535
|
||||
main2:
|
||||
enabled: true
|
||||
primary: false
|
||||
port: 65534
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: At least one port must be set as primary in service (main)
|
||||
|
||||
- it: should fail without ports dict in an enabled service
|
||||
set:
|
||||
service:
|
||||
other:
|
||||
enabled: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: At least one port is required in an enabled service (other)
|
||||
|
||||
- it: should fail with disabled port on enabled service
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
enabled: false
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: No ports are enabled for the service
|
||||
|
||||
- it: should fail with invalid protocol
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
port: 443
|
||||
protocol: NOT_VALID
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Not valid <protocol> (NOT_VALID)
|
||||
|
||||
- it: should pass with only port set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
port: 443
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].ports[0]
|
||||
value:
|
||||
name: main
|
||||
containerPort: 443
|
||||
protocol: TCP
|
||||
|
||||
- it: should pass with port and targetPort set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
port: 443
|
||||
targetPort: 8000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].ports[0]
|
||||
value:
|
||||
name: main
|
||||
containerPort: 8000
|
||||
protocol: TCP
|
||||
|
||||
- it: should pass with port and targetPort and protocol set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
port: 443
|
||||
protocol: TCP
|
||||
targetPort: 8000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].ports[0]
|
||||
value:
|
||||
name: main
|
||||
containerPort: 8000
|
||||
protocol: TCP
|
||||
|
||||
- it: should pass with port and targetPort and protocol UDP set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
port: 443
|
||||
protocol: UDP
|
||||
targetPort: 8000
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
enabled: false
|
||||
readiness:
|
||||
enabled: false
|
||||
startup:
|
||||
enabled: false
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].ports[0]
|
||||
value:
|
||||
name: main
|
||||
containerPort: 8000
|
||||
protocol: UDP
|
||||
|
||||
- it: should pass with port and targetPort and protocol HTTP set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
port: 443
|
||||
protocol: HTTP
|
||||
targetPort: 8000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].ports[0]
|
||||
value:
|
||||
name: main
|
||||
containerPort: 8000
|
||||
protocol: TCP
|
||||
|
||||
- it: should pass with port and targetPort and protocol HTTPS set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
port: 443
|
||||
protocol: HTTPS
|
||||
targetPort: 8000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].ports[0]
|
||||
value:
|
||||
name: main
|
||||
containerPort: 8000
|
||||
protocol: TCP
|
||||
|
||||
- it: should pass with multiple port and targetPort and protocol set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
port: 443
|
||||
protocol: HTTP
|
||||
targetPort: 8000
|
||||
secondary:
|
||||
enabled: true
|
||||
ports:
|
||||
secondary:
|
||||
enabled: true
|
||||
port: 444
|
||||
protocol: TCP
|
||||
targetPort: 8001
|
||||
third:
|
||||
enabled: true
|
||||
ports:
|
||||
third:
|
||||
enabled: true
|
||||
port: 445
|
||||
protocol: UDP
|
||||
targetPort: 8002
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].ports
|
||||
value:
|
||||
- name: main
|
||||
containerPort: 8000
|
||||
protocol: TCP
|
||||
- name: secondary
|
||||
containerPort: 8001
|
||||
protocol: TCP
|
||||
- name: third
|
||||
containerPort: 8002
|
||||
protocol: UDP
|
||||
@@ -1,931 +0,0 @@
|
||||
suite: container in deployment probe test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0]
|
||||
content:
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
scheme: HTTP
|
||||
port: 65535
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
scheme: HTTP
|
||||
port: 65535
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
scheme: HTTP
|
||||
port: 65535
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 60
|
||||
timeoutSeconds: 2
|
||||
periodSeconds: 5
|
||||
|
||||
- it: should fail with wrong probe name
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
invalid_probe_name:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid probe name (invalid_probe_name) in (RELEASE-NAME-common-test) container. Valid options are (liveness, readiness, startup)
|
||||
|
||||
- it: should fail with auto probe type and no service enabled
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: false
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: auto
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <auto> probe type in probe (liveness) in (RELEASE-NAME-common-test) container, is only supported for the main container and only if there is at least 1 port enabled
|
||||
|
||||
- it: should fail with probe type set to UDP
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: udp
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid probe type (udp) on probe (liveness) in (RELEASE-NAME-common-test) container. Valid types are tcp, http, https, grpc, exec, auto
|
||||
|
||||
- it: should fail with probe type auto and port protocol UDP
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: auto
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
port: 65535
|
||||
protocol: UDP
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: UDP Probes are not supported. Please use a different probe type or disable probes in (RELEASE-NAME-common-test) container.
|
||||
|
||||
- it: should fail without commands on exec probe
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: exec
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: No commands were defined for <exec> type on probe (liveness) in (RELEASE-NAME-common-test) container.
|
||||
|
||||
- it: should fail without port on http(s) liveness probe and disabled service
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: false
|
||||
ports:
|
||||
main:
|
||||
enabled: false
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
path: "/"
|
||||
type: http
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <port> must be defined for <http>/<https> probe types in probe (liveness) in (RELEASE-NAME-common-test) container.
|
||||
|
||||
- it: should fail without port on http(s) liveness probe and disabled service
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: false
|
||||
ports:
|
||||
main:
|
||||
enabled: false
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
path: "/"
|
||||
type: https
|
||||
port:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <port> must be defined for <http>/<https> probe types in probe (liveness) in (RELEASE-NAME-common-test) container.
|
||||
|
||||
- it: should fail without port on http(s) liveness probe and disabled service
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: false
|
||||
ports:
|
||||
main:
|
||||
enabled: false
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
path: "/"
|
||||
type: http
|
||||
port:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <port> must be defined for <http>/<https> probe types in probe (liveness) in (RELEASE-NAME-common-test) container.
|
||||
|
||||
- it: should fail without initialDelaySeconds on non-custom probes
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
spec:
|
||||
initialDelaySeconds:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <initialDelaySeconds> cannot be empty in probe (liveness) in (RELEASE-NAME-common-test) container
|
||||
|
||||
- it: should fail without failureThreshold on non-custom probes
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
spec:
|
||||
failureThreshold:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <failureThreshold> cannot be empty in probe (liveness) in (RELEASE-NAME-common-test) container
|
||||
|
||||
- it: should fail without timeoutSeconds on non-custom probes
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
spec:
|
||||
timeoutSeconds:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <timeoutSeconds> cannot be empty in probe (liveness) in (RELEASE-NAME-common-test) container
|
||||
|
||||
- it: should fail without periodSeconds on non-custom probes
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
spec:
|
||||
periodSeconds:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <periodSeconds> cannot be empty in probe (liveness) in (RELEASE-NAME-common-test) container
|
||||
|
||||
- it: should fail with invalid probe type
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: not_valid_type
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid probe type (not_valid_type) on probe (liveness) in (RELEASE-NAME-common-test) container. Valid types are tcp, http, https, grpc, exec, auto
|
||||
|
||||
- it: should fail with probe path not starting with /
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: http
|
||||
path: a/random/path
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Probe in container (RELEASE-NAME-common-test) with path (a/random/path), must start with a forward slash -> / <-
|
||||
|
||||
- it: should fail with httpHeader value is defined as list
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: http
|
||||
httpHeaders:
|
||||
some_header:
|
||||
- list_value
|
||||
- list_value2
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Lists or Dicts are not allowed in httpHeaders on probe (liveness)
|
||||
|
||||
- it: should fail with httpHeader value is defined as dict
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: http
|
||||
httpHeaders:
|
||||
some_header:
|
||||
some_key:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Lists or Dicts are not allowed in httpHeaders on probe (liveness)
|
||||
|
||||
- it: should fail without spec in custom defined probe
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: custom
|
||||
spec: {}
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <spec> must be defined for <custom> probe types in probe (liveness) in (RELEASE-NAME-common-test) container.
|
||||
|
||||
- it: should pass with with custom defined liveness probe
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: custom
|
||||
spec:
|
||||
httpGet:
|
||||
path: /path
|
||||
scheme: HTTPS
|
||||
port: 1234
|
||||
initialDelaySeconds: 15
|
||||
failureThreshold: 10
|
||||
timeoutSeconds: 10
|
||||
periodSeconds: 15
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /path
|
||||
scheme: HTTPS
|
||||
port: 1234
|
||||
initialDelaySeconds: 15
|
||||
failureThreshold: 10
|
||||
timeoutSeconds: 10
|
||||
periodSeconds: 15
|
||||
|
||||
- it: should pass with with custom defined readiness probe
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
readiness:
|
||||
type: custom
|
||||
spec:
|
||||
httpGet:
|
||||
path: /path
|
||||
scheme: HTTPS
|
||||
port: 1234
|
||||
initialDelaySeconds: 15
|
||||
failureThreshold: 10
|
||||
timeoutSeconds: 10
|
||||
periodSeconds: 15
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].readinessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /path
|
||||
scheme: HTTPS
|
||||
port: 1234
|
||||
initialDelaySeconds: 15
|
||||
failureThreshold: 10
|
||||
timeoutSeconds: 10
|
||||
periodSeconds: 15
|
||||
|
||||
- it: should pass with with custom defined startup probe
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
startup:
|
||||
type: custom
|
||||
spec:
|
||||
httpGet:
|
||||
path: /path
|
||||
scheme: HTTPS
|
||||
port: 1234
|
||||
initialDelaySeconds: 15
|
||||
failureThreshold: 10
|
||||
timeoutSeconds: 10
|
||||
periodSeconds: 15
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].startupProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /path
|
||||
scheme: HTTPS
|
||||
port: 1234
|
||||
initialDelaySeconds: 15
|
||||
failureThreshold: 10
|
||||
timeoutSeconds: 10
|
||||
periodSeconds: 15
|
||||
|
||||
- it: should pass with with no probe type and service HTTP
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
protocol: HTTP
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /
|
||||
scheme: HTTP
|
||||
port: 65535
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with with probe type TCP and service TCP
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: tcp
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
tcpSocket:
|
||||
port: 65535
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should fail without port on tcp liveness probe and disabled service
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: false
|
||||
ports:
|
||||
main:
|
||||
enabled: false
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
path: "/"
|
||||
type: tcp
|
||||
port: ""
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <port> must be defined for <tcp> probe types in probe (liveness) in (RELEASE-NAME-common-test) container.
|
||||
|
||||
- it: should pass with with no probe type and service HTTP with custom path
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
protocol: HTTP
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
path: /some_path
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /some_path
|
||||
scheme: HTTP
|
||||
port: 65535
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with with no probe type and service HTTP with custom port
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
protocol: HTTP
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
port: 1234
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /
|
||||
scheme: HTTP
|
||||
port: 1234
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with with no probe type and service HTTP with httpHeaders
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
protocol: HTTP
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
httpHeaders:
|
||||
some_header: 1234
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /
|
||||
scheme: HTTP
|
||||
port: 65535
|
||||
httpHeaders:
|
||||
- name: some_header
|
||||
value: 1234
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with with probe type HTTP with httpHeaders set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_header_value: 1234
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: http
|
||||
httpHeaders:
|
||||
some_header: "{{ .Values.some_header_value }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /
|
||||
scheme: HTTP
|
||||
port: 65535
|
||||
httpHeaders:
|
||||
- name: some_header
|
||||
value: 1234
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with with probe type HTTP with multiple httpHeaders set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_header_value: 1234
|
||||
some_header_value2: some_value
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: http
|
||||
httpHeaders:
|
||||
some_header: "{{ .Values.some_header_value }}"
|
||||
some_header2: "{{ .Values.some_header_value2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /
|
||||
scheme: HTTP
|
||||
port: 65535
|
||||
httpHeaders:
|
||||
- name: some_header
|
||||
value: 1234
|
||||
- name: some_header2
|
||||
value: some_value
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with with probe type HTTP with path set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_path: /ping
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: http
|
||||
path: "{{ .Values.some_path }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /ping
|
||||
scheme: HTTP
|
||||
port: 65535
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with with probe type HTTP with port set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_port: 1234
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: http
|
||||
port: "{{ .Values.some_port }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /
|
||||
scheme: HTTP
|
||||
port: 1234
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with with probe type TCP with port set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_port: 1234
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: tcp
|
||||
port: "{{ .Values.some_port }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
tcpSocket:
|
||||
port: 1234
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with with changed times
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: tcp
|
||||
spec:
|
||||
initialDelaySeconds: 15
|
||||
failureThreshold: 10
|
||||
timeoutSeconds: 10
|
||||
periodSeconds: 15
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
tcpSocket:
|
||||
port: 65535
|
||||
initialDelaySeconds: 15
|
||||
failureThreshold: 10
|
||||
timeoutSeconds: 10
|
||||
periodSeconds: 15
|
||||
|
||||
- it: should pass with with probe type GRPC
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: grpc
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
grpc:
|
||||
port: 65535
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should fail without port on grpc liveness probe and disabled service
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: false
|
||||
ports:
|
||||
main:
|
||||
enabled: false
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
path: "/"
|
||||
type: grpc
|
||||
port: ""
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <port> must be defined for <grpc> probe types in probe (liveness) in (RELEASE-NAME-common-test) container.
|
||||
|
||||
- it: should pass with with probe type exec with multiline command
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: exec
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
echo "probe!"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
exec:
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
echo "probe!"
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with with probe type exec with multiline command from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_msg: probe!
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: exec
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
echo "{{ .Values.some_msg }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
exec:
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
echo "probe!"
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with with probe type exec single command
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: exec
|
||||
command: env
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
exec:
|
||||
command:
|
||||
- env
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with with probe type exec single command from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_command: env
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: exec
|
||||
command: "{{ .Values.some_command }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
exec:
|
||||
command:
|
||||
- env
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with with probe type exec single command and custom timings
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
probes:
|
||||
liveness:
|
||||
type: exec
|
||||
command: env
|
||||
spec:
|
||||
initialDelaySeconds: 15
|
||||
failureThreshold: 10
|
||||
timeoutSeconds: 10
|
||||
periodSeconds: 15
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
exec:
|
||||
command:
|
||||
- env
|
||||
initialDelaySeconds: 15
|
||||
failureThreshold: 10
|
||||
timeoutSeconds: 10
|
||||
periodSeconds: 15
|
||||
@@ -1,735 +0,0 @@
|
||||
suite: container in deployment resources test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
limits:
|
||||
cpu: 4000m
|
||||
memory: 8Gi
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 50Mi
|
||||
|
||||
- it: should fail with inherit defined in main container
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
inherit:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.inherit> key is only available for additional/init/install/upgrade containers.
|
||||
|
||||
- it: should fail with empty key in gpu
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU:
|
||||
somekey:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 100Mi
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Value is not provided for GPU (<key> somekey)
|
||||
|
||||
- it: should fail with empty requests.cpu
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu:
|
||||
memory: 100Mi
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.requests.cpu> cannot be empty.
|
||||
|
||||
- it: should fail with empty requests.memory
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.requests.memory> cannot be empty.
|
||||
|
||||
- it: should fail with invalid format in requests.memory (zero)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU:
|
||||
somekey:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 0.0
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.requests.memory> has invalid format in value (0). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
|
||||
|
||||
- it: should fail with invalid format in requests.memory (zero exponent)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU:
|
||||
somekey:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 0e0
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.requests.memory> has invalid format in value (0). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
|
||||
|
||||
- it: should fail with invalid format in requests.memory (zero with suffix)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU:
|
||||
somekey:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 0M
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.requests.memory> has invalid format in value (0M). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
|
||||
|
||||
- it: should fail with invalid format in requests.memory (string)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU:
|
||||
somekey:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: not-valid
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.requests.memory> has invalid format in value (not-valid). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
|
||||
|
||||
- it: should fail with invalid format in limits.memory (zero)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 0.0
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 100Mi
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.limits.memory> has invalid format in value (0). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
|
||||
|
||||
- it: should fail with invalid format in limits.memory (zero exponent)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 0e0
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 100Mi
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.limits.memory> has invalid format in value (0). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
|
||||
|
||||
- it: should fail with invalid format in requests.limits (zero with suffix)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 0M
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 100Mi
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.limits.memory> has invalid format in value (0M). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
|
||||
|
||||
- it: should fail with invalid format in limits.memory (string)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: not-valid
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 100Mi
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.limits.memory> has invalid format in value (not-valid). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
|
||||
|
||||
- it: should fail with invalid format in limits.cpu (zero)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 0.0
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 100Mi
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.limits.cpu> has invalid format in value (0). Valid formats are (Plain Integer eg. 1) (Float eg. 0.5) (Milicpu 500m).
|
||||
|
||||
- it: should fail with invalid format in limits.cpu (zero with suffix)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 0m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 100Mi
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.limits.cpu> has invalid format in value (0m). Valid formats are (Plain Integer eg. 1) (Float eg. 0.5) (Milicpu 500m).
|
||||
|
||||
- it: should fail with invalid format in limits.cpu (string)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: not-valid
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 100Mi
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.limits.cpu> has invalid format in value (not-valid). Valid formats are (Plain Integer eg. 1) (Float eg. 0.5) (Milicpu 500m).
|
||||
|
||||
- it: should fail with invalid format in requests.cpu (zero)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 4000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 0.0
|
||||
memory: 100Mi
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.requests.cpu> has invalid format in value (0). Valid formats are (Plain Integer eg. 1) (Float eg. 0.5) (Milicpu 500m).
|
||||
|
||||
- it: should fail with invalid format in requests.cpu (zero with suffix)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 4000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 0m
|
||||
memory: 100Mi
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.requests.cpu> has invalid format in value (0m). Valid formats are (Plain Integer eg. 1) (Float eg. 0.5) (Milicpu 500m).
|
||||
|
||||
- it: should fail with invalid format in requests.cpu (string)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 4000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: not-valid
|
||||
memory: 100Mi
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <resources.requests.cpu> has invalid format in value (not-valid). Valid formats are (Plain Integer eg. 1) (Float eg. 0.5) (Milicpu 500m).
|
||||
|
||||
- it: should pass with changed resources
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 100Mi
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 100Mi
|
||||
|
||||
- it: should pass with only limits.cpu resource changed
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 8Gi
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 50Mi
|
||||
|
||||
- it: should pass with only limits.memory resource changed
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
memory: 4Gi
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
limits:
|
||||
cpu: 4000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 50Mi
|
||||
|
||||
- it: should pass with only requests.cpu resource changed
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
requests:
|
||||
cpu: 20m
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
limits:
|
||||
cpu: 4000m
|
||||
memory: 8Gi
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 50Mi
|
||||
|
||||
- it: should pass with only requests.memory resource changed
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
requests:
|
||||
memory: 25Mi
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
limits:
|
||||
cpu: 4000m
|
||||
memory: 8Gi
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 25Mi
|
||||
|
||||
- it: should pass with only scaleGOU resource changed
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU:
|
||||
gpu.intel.com/i915: "1"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
limits:
|
||||
cpu: 4000m
|
||||
memory: 8Gi
|
||||
gpu.intel.com/i915: "1"
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 50Mi
|
||||
|
||||
- it: should pass with changed resources and added GPU
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU:
|
||||
gpu.intel.com/i915: "1"
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 100Mi
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 4Gi
|
||||
gpu.intel.com/i915: "1"
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 100Mi
|
||||
|
||||
- it: should pass with empty resources.limits
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu:
|
||||
memory:
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 50Mi
|
||||
|
||||
- it: should pass with only limits.cpu defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU: {}
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory:
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
limits:
|
||||
cpu: 3000m
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 50Mi
|
||||
|
||||
- it: should pass with only limits.memory defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU: {}
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu:
|
||||
memory: 4Gi
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
limits:
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 50Mi
|
||||
|
||||
- it: should pass with only requests.cpu defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU: {}
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu:
|
||||
memory:
|
||||
requests:
|
||||
cpu: 30m
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
requests:
|
||||
cpu: 30m
|
||||
memory: 50Mi
|
||||
|
||||
- it: should pass with only requests.memory defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU: {}
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu:
|
||||
memory:
|
||||
requests:
|
||||
memory: 15Mi
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 15Mi
|
||||
|
||||
- it: should pass with only limits.gpu defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU:
|
||||
gpu.intel.com/i915: "1"
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu:
|
||||
memory:
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
limits:
|
||||
gpu.intel.com/i915: "1"
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 50Mi
|
||||
|
||||
- it: should pass with only requests defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU: {}
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu:
|
||||
memory:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 50Mi
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 50Mi
|
||||
|
||||
- it: should pass with only limits defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU: {}
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 1000m
|
||||
memory: 1Gi
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
limits:
|
||||
cpu: 1000m
|
||||
memory: 1Gi
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 50Mi
|
||||
|
||||
- it: should pass with only gpu defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU:
|
||||
gpu.intel.com/i915: "1"
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
resources:
|
||||
limits:
|
||||
cpu:
|
||||
memory:
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources
|
||||
value:
|
||||
limits:
|
||||
gpu.intel.com/i915: "1"
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 50Mi
|
||||
@@ -1,490 +0,0 @@
|
||||
suite: container in deployment securityContext test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 568
|
||||
runAsGroup: 568
|
||||
capabilities:
|
||||
add: []
|
||||
drop:
|
||||
- ALL
|
||||
|
||||
- it: should pass with securityContext changed
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsNonRoot: false
|
||||
runAsUser: 0
|
||||
runAsGroup: 0
|
||||
readOnlyRootFilesystem: false
|
||||
allowPrivilegeEscalation: true
|
||||
privileged: true
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_MODULE
|
||||
drop:
|
||||
- NET_ADMIN
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: true
|
||||
privileged: true
|
||||
readOnlyRootFilesystem: false
|
||||
runAsNonRoot: false
|
||||
runAsUser: 0
|
||||
runAsGroup: 0
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_MODULE
|
||||
drop:
|
||||
- NET_ADMIN
|
||||
|
||||
- it: should pass with securityContext changed from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
source:
|
||||
addCap: SYS_MODULE
|
||||
remCap: NET_ADMIN
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
capabilities:
|
||||
add:
|
||||
- "{{ .Values.source.addCap }}"
|
||||
drop:
|
||||
- "{{ .Values.source.remCap }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_MODULE
|
||||
drop:
|
||||
- NET_ADMIN
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 568
|
||||
runAsGroup: 568
|
||||
|
||||
- it: should fail with inherit key added in securityContext on main container
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
inherit: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <securityContext.inherit> key is only available for additional/init/install/upgrade containers.
|
||||
|
||||
- it: should fail with securityContext changed, runAsNonRoot true and runAsUser 0
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 0
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: You are trying to run as root (user or group), but runAsNonRoot is set to true
|
||||
|
||||
- it: should fail with securityContext changed, runAsNonRoot true and runAsGroup 0
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 0
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: You are trying to run as root (user or group), but runAsNonRoot is set to true
|
||||
|
||||
- it: should fail with securityContext changed and runAsNonRoot set to a non-bool value
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsNonRoot: non-bool
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <runAsNonRoot> key has value (non-bool). But it must be boolean.
|
||||
|
||||
- it: should fail with securityContext changed and privileged set to a non-bool value
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
privileged: non-bool
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <privileged> key has value (non-bool). But it must be boolean.
|
||||
|
||||
- it: should fail with securityContext changed and readOnlyRootFilesystem set to a non-bool value
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
readOnlyRootFilesystem: non-bool
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <readOnlyRootFilesystem> key has value (non-bool). But it must be boolean.
|
||||
|
||||
- it: should fail with securityContext changed and allowPrivilegeEscalation set to a non-bool value
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: non-bool
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <allowPrivilegeEscalation> key has value (non-bool). But it must be boolean.
|
||||
|
||||
- it: should fail with securityContext changed and capabilities.add is not a list
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
capabilities:
|
||||
add: non-a-list
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <capabilities.add> key has value (non-a-list). But it must be a list. Set a list value or remove the key for the default ([]) to take effect.
|
||||
|
||||
- it: should fail with securityContext changed and capabilities.drop is not a list
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
capabilities:
|
||||
drop: non-a-list
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <capabilities.drop> key has value (non-a-list). But it must be a list. Set a list value or remove the key for the default ([ALL]) to take effect.
|
||||
|
||||
- it: should fail with empty capabilities.drop in securityContext
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
capabilities:
|
||||
drop:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <capabilities.drop> key has value (<nil>). But it must be a list. Set a list value or remove the key for the default ([ALL]) to take effect.
|
||||
|
||||
- it: should fail with empty capabilities.add in securityContext
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
capabilities:
|
||||
add:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <capabilities.add> key has value (<nil>). But it must be a list. Set a list value or remove the key for the default ([]) to take effect.
|
||||
|
||||
- it: should fail with empty runAsGroup in securityContext
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsGroup:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <runAsGroup> key cannot be empty. Set a value or remove the key for the default (568) to take effect.
|
||||
|
||||
- it: should fail with non int runAsGroup in securityContext
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsGroup: "1000"
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <runAsGroup> key has value of ("1000"). But must be an int.
|
||||
|
||||
- it: should fail with non int runAsUser in securityContext
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsUser: "1000"
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <runAsUser> key has value of ("1000"). But must be an int.
|
||||
|
||||
- it: should fail with empty runAsUser in securityContext
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsUser:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <runAsUser> key cannot be empty. Set a value or remove the key for the default (568) to take effect.
|
||||
|
||||
- it: should fail with empty privileged in securityContext
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
privileged:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <privileged> key has value (<nil>). But it must be boolean.
|
||||
|
||||
- it: should fail with empty allowPrivilegeEscalation in securityContext
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
allowPrivilegeEscalation:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <allowPrivilegeEscalation> key has value (<nil>). But it must be boolean.
|
||||
|
||||
- it: should fail with empty readOnlyRootFilesystem in securityContext
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
readOnlyRootFilesystem:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <readOnlyRootFilesystem> key has value (<nil>). But it must be boolean.
|
||||
|
||||
- it: should fail with empty runAsNonRoot in securityContext
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsNonRoot:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <runAsNonRoot> key has value (<nil>). But it must be boolean.
|
||||
|
||||
- it: should pass with deviceList defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
deviceList:
|
||||
- enabled: true
|
||||
hostPath: /dev/usb
|
||||
mountPath: /host/dev/usb
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 568
|
||||
fsGroupChangePolicy: OnRootMismatch
|
||||
supplementalGroups:
|
||||
- 5
|
||||
- 10
|
||||
- 20
|
||||
- 24
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: true
|
||||
privileged: true
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 568
|
||||
runAsGroup: 568
|
||||
capabilities:
|
||||
add: []
|
||||
drop:
|
||||
- ALL
|
||||
|
||||
- it: should pass with scaleGPU defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU:
|
||||
nvidia: something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 568
|
||||
fsGroupChangePolicy: OnRootMismatch
|
||||
supplementalGroups:
|
||||
- 44
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 568
|
||||
runAsGroup: 568
|
||||
capabilities:
|
||||
add: []
|
||||
drop:
|
||||
- ALL
|
||||
|
||||
- it: should pass with both scaleGPU and deviceList defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
deviceList:
|
||||
- enabled: true
|
||||
hostPath: /dev/usb
|
||||
mountPath: /host/dev/usb
|
||||
scaleGPU:
|
||||
nvidia: something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 568
|
||||
fsGroupChangePolicy: OnRootMismatch
|
||||
supplementalGroups:
|
||||
- 5
|
||||
- 10
|
||||
- 20
|
||||
- 24
|
||||
- 44
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: true
|
||||
privileged: true
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 568
|
||||
runAsGroup: 568
|
||||
capabilities:
|
||||
add: []
|
||||
drop:
|
||||
- ALL
|
||||
|
||||
- it: should pass with container port <=1024 defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
port: 5000
|
||||
targetPort: 1024
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 568
|
||||
runAsGroup: 568
|
||||
capabilities:
|
||||
add:
|
||||
- NET_BIND_SERVICE
|
||||
drop:
|
||||
- ALL
|
||||
|
||||
- it: should pass with container port <=1024 defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
port: 5000
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 568
|
||||
runAsGroup: 568
|
||||
capabilities:
|
||||
add:
|
||||
- NET_BIND_SERVICE
|
||||
drop:
|
||||
- ALL
|
||||
@@ -1,116 +0,0 @@
|
||||
|
||||
suite: container in deployment various options test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should pass with tty set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
tty: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].tty
|
||||
value: true
|
||||
|
||||
- it: should pass with stdin set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
stdin: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].stdin
|
||||
value: true
|
||||
|
||||
- it: should pass with terminationMessagePath set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
termination:
|
||||
messagePath: /tmp/log
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].terminationMessagePath
|
||||
value: /tmp/log
|
||||
|
||||
- it: should pass with terminationMessagePath set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_path: /tmp/log
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
termination:
|
||||
messagePath: "{{ .Values.some_path }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].terminationMessagePath
|
||||
value: /tmp/log
|
||||
|
||||
- it: should pass with terminationMessagePolicy set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
termination:
|
||||
messagePolicy: FallbackToLogsOnError
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].terminationMessagePolicy
|
||||
value: FallbackToLogsOnError
|
||||
|
||||
- it: should pass with terminationMessagePolicy set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_key: FallbackToLogsOnError
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
termination:
|
||||
messagePolicy: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].terminationMessagePolicy
|
||||
value: FallbackToLogsOnError
|
||||
|
||||
- it: should fail with invalid terminationMessagePolicy
|
||||
set:
|
||||
some_key: invalid
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
termination:
|
||||
messagePolicy: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Not valid option for messagePolicy (invalid). Valid options are FallbackToLogsOnError and File
|
||||
@@ -1,263 +0,0 @@
|
||||
suite: container in deployment volumeMount test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
value:
|
||||
- mountPath: /shared
|
||||
name: shared
|
||||
- mountPath: /tmp
|
||||
name: tmp
|
||||
- mountPath: /var/logs
|
||||
name: varlogs
|
||||
|
||||
- it: should fail with no mountPath set
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <mountPath> must be defined, alternatively use the <noMount> flag.
|
||||
|
||||
- it: should fail when mountPath does not start with /
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: relative/path/to/dir
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Mount path (relative/path/to/dir), must start with a forward slash -> / <-
|
||||
|
||||
- it: should fail with empty readOnly
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /some/path
|
||||
readOnly:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <readOnly> cannot be empty on item (vol1)
|
||||
|
||||
- it: should fail with empty mountPath
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <mountPath> must be defined, alternatively use the <noMount> flag.
|
||||
|
||||
- it: should pass with enabled false
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: false
|
||||
asserts:
|
||||
- notContains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
name: vol1
|
||||
|
||||
- it: should pass with noMount true
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
noMount: true
|
||||
asserts:
|
||||
- notContains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
name: vol1
|
||||
|
||||
- it: should pass with mountPath set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /some_path
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /some_path
|
||||
name: vol1
|
||||
|
||||
- it: should pass with mountPath set (multiple entries)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /some_path
|
||||
vol2:
|
||||
enabled: true
|
||||
mountPath: /some_path2
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /some_path
|
||||
name: vol1
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /some_path2
|
||||
name: vol2
|
||||
|
||||
- it: should pass with mountPath and readOnly(true) set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /some_path
|
||||
readOnly: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /some_path
|
||||
name: vol1
|
||||
readOnly: true
|
||||
|
||||
- it: should pass with mountPath and readOnly(false) set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /some_path
|
||||
readOnly: false
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /some_path
|
||||
name: vol1
|
||||
readOnly: false
|
||||
|
||||
- it: should pass with mountPath and subPath set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /some_path
|
||||
subPath: config.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /some_path
|
||||
name: vol1
|
||||
subPath: config.yaml
|
||||
|
||||
- it: should pass with mountPath and mountPropagation set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /some_path
|
||||
mountPropagation: HostToContainer
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /some_path
|
||||
name: vol1
|
||||
mountPropagation: HostToContainer
|
||||
|
||||
- it: should pass with all set set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /some_path
|
||||
mountPropagation: HostToContainer
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /some_path
|
||||
name: vol1
|
||||
mountPropagation: HostToContainer
|
||||
|
||||
- it: should pass with all set (readonly false)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /some_path
|
||||
subPath: config.yaml
|
||||
readOnly: false
|
||||
mountPropagation: HostToContainer
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /some_path
|
||||
name: vol1
|
||||
subPath: config.yaml
|
||||
readOnly: false
|
||||
mountPropagation: HostToContainer
|
||||
|
||||
- it: should pass with all set (readonly true)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /some_path
|
||||
subPath: config.yaml
|
||||
readOnly: true
|
||||
mountPropagation: HostToContainer
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /some_path
|
||||
name: vol1
|
||||
subPath: config.yaml
|
||||
readOnly: true
|
||||
mountPropagation: HostToContainer
|
||||
|
||||
- it: should pass with all set (readonly true) from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_mount: /some_path
|
||||
sub_path: config.yaml
|
||||
mount_propagation: HostToContainer
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: "{{ .Values.some_mount }}"
|
||||
subPath: "{{ .Values.sub_path }}"
|
||||
readOnly: true
|
||||
mountPropagation: "{{ .Values.mount_propagation }}"
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /some_path
|
||||
name: vol1
|
||||
subPath: config.yaml
|
||||
readOnly: true
|
||||
mountPropagation: HostToContainer
|
||||
@@ -1,63 +0,0 @@
|
||||
suite: cronjob annotation test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &cronJobDoc 2
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: CronJob
|
||||
schedule: "*/1 * * * *"
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: CronJob
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
|
||||
- it: should pass with controller and global annotations
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
some_key: some_value
|
||||
controllers:
|
||||
main:
|
||||
type: CronJob
|
||||
schedule: "*/1 * * * *"
|
||||
annotations:
|
||||
controller_key: controller_value
|
||||
controller_key2: "{{ .Values.some_key }}"
|
||||
global:
|
||||
annotations:
|
||||
global_key: global_value
|
||||
global_key2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: metadata.annotations
|
||||
content:
|
||||
controller_key: controller_value
|
||||
controller_key2: some_value
|
||||
global_key: global_value
|
||||
global_key2: some_value
|
||||
- isNull:
|
||||
path: metadata.annotations.rollme
|
||||
|
||||
- it: should pass with podAnnotations set
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
some_key: some_value2
|
||||
controllers:
|
||||
main:
|
||||
type: CronJob
|
||||
schedule: "*/1 * * * *"
|
||||
pod:
|
||||
annotations:
|
||||
test: some_value
|
||||
test2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: metadata.annotations
|
||||
content:
|
||||
test2: some_value2
|
||||
test: some_value
|
||||
@@ -1,54 +0,0 @@
|
||||
suite: cronjob controller test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with strategy changed in cronjob
|
||||
documentIndex: &cronJobDoc 2
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: CronJob
|
||||
schedule: "* * * * *"
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: CronJob
|
||||
|
||||
- it: should pass with job options changed in cronJob
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: CronJob
|
||||
backoffLimit: 11
|
||||
ttlSecondsAfterFinished: 22
|
||||
activeDeadlineSeconds: 33
|
||||
parallelism: 44
|
||||
completions: 55
|
||||
completionMode: Indexed
|
||||
schedule: "* * * * *"
|
||||
concurrencyPolicy: Allow
|
||||
failedJobsHistoryLimit: 7
|
||||
successfulJobsHistoryLimit: 11
|
||||
timezone: "America/New_York"
|
||||
startingDeadlineSeconds: 13
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
schedule: "* * * * *"
|
||||
timeZone: "America/New_York"
|
||||
concurrencyPolicy: Allow
|
||||
failedJobsHistoryLimit: 7
|
||||
successfulJobsHistoryLimit: 11
|
||||
startingDeadlineSeconds: 13
|
||||
- isSubset:
|
||||
path: spec.jobTemplate.spec
|
||||
content:
|
||||
backoffLimit: 11
|
||||
ttlSecondsAfterFinished: 22
|
||||
activeDeadlineSeconds: 33
|
||||
parallelism: 44
|
||||
completions: 55
|
||||
completionMode: Indexed
|
||||
@@ -1,155 +0,0 @@
|
||||
suite: cronjob default test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with controller set to CronJob
|
||||
documentIndex: &cronjobDoc 2
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: CronJob
|
||||
schedule: "*/5 * * * *"
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: CronJob
|
||||
- isAPIVersion:
|
||||
of: batch/v1
|
||||
- equal:
|
||||
path: spec.schedule
|
||||
value: "*/5 * * * *"
|
||||
- equal:
|
||||
path: spec.timeZone
|
||||
value: UTC
|
||||
- equal:
|
||||
path: spec.concurrencyPolicy
|
||||
value: Forbid
|
||||
- equal:
|
||||
path: spec.failedJobsHistoryLimit
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.successfulJobsHistoryLimit
|
||||
value: 3
|
||||
- isNull:
|
||||
path: spec.startingDeadlineSeconds
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.backoffLimit
|
||||
value: 6
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.ttlSecondsAfterFinished
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.activeDeadlineSeconds
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.parallelism
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.completions
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.completionMode
|
||||
value: NonIndexed
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.hostNetwork
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.enableServiceLinks
|
||||
value: false
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.serviceAccountName
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.restartPolicy
|
||||
value: Never
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.schedulerName
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.priorityClassName
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.hostname
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.dnsPolicy
|
||||
value: ClusterFirst
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.dnsConfig
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.hostAliases
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.nodeSelector
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.tolerations
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.imagePullSecrets
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.runtimeClassName
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.terminationGracePeriodSeconds
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.containers[0].name
|
||||
value: RELEASE-NAME-common-test-job-main
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.containers[0].image
|
||||
value: repo:tag
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.containers[0].command
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.containers[0].args
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.containers[0].tty
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.containers[0].stdin
|
||||
value: false
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.containers[0].lifecycle
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.containers[0].terminationMessagePath
|
||||
- isNull:
|
||||
path: spec.jobTemplate.spec.template.spec.containers[0].terminationMessagePolicy
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 568
|
||||
fsGroupChangePolicy: OnRootMismatch
|
||||
supplementalGroups: []
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 568
|
||||
runAsGroup: 568
|
||||
capabilities:
|
||||
add: []
|
||||
drop:
|
||||
- ALL
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.containers[0].volumeMounts
|
||||
value:
|
||||
- mountPath: /shared
|
||||
name: shared
|
||||
- mountPath: /tmp
|
||||
name: tmp
|
||||
- mountPath: /var/logs
|
||||
name: varlogs
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.volumes
|
||||
value:
|
||||
- name: shared
|
||||
emptyDir: {}
|
||||
- name: tmp
|
||||
emptyDir: {}
|
||||
- name: varlogs
|
||||
emptyDir: {}
|
||||
@@ -1,301 +0,0 @@
|
||||
suite: cronjob generic test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with controller set to CronJob
|
||||
documentIndex: &cronjobDoc 2
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: CronJob
|
||||
schedule: "*/5 * * * *"
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: CronJob
|
||||
- isAPIVersion:
|
||||
of: batch/v1
|
||||
|
||||
- it: should pass with podSecurityContext changed
|
||||
documentIndex: *cronjobDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: CronJob
|
||||
schedule: "* * * * *"
|
||||
pod:
|
||||
securityContext:
|
||||
fsGroup: 0
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 0
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
|
||||
- it: should pass with podSecurityContext changed from the default
|
||||
documentIndex: *cronjobDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: CronJob
|
||||
schedule: "* * * * *"
|
||||
podSecurityContext:
|
||||
fsGroup: 0
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 0
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
|
||||
- it: should pass with securityContext changed
|
||||
documentIndex: *cronjobDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: CronJob
|
||||
schedule: "* * * * *"
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
capabilities:
|
||||
add:
|
||||
- something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
capabilities:
|
||||
add:
|
||||
- something
|
||||
drop:
|
||||
- ALL
|
||||
|
||||
- it: should pass with securityContext changed from the default
|
||||
documentIndex: *cronjobDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: CronJob
|
||||
schedule: "* * * * *"
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
capabilities:
|
||||
add:
|
||||
- something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
capabilities:
|
||||
add:
|
||||
- something
|
||||
drop:
|
||||
- ALL
|
||||
|
||||
- it: should pass with multiple envs defined via tpl
|
||||
documentIndex: *cronjobDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: CronJob
|
||||
schedule: "* * * * *"
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR: "{{ .Values.some_string }}"
|
||||
ENVVAR2: "{{ .Values.some_int }}"
|
||||
ENVVAR3: "{{ .Values.some_bool }}"
|
||||
some_string: a_string
|
||||
some_int: 123
|
||||
some_bool: false
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: ENVVAR
|
||||
value: "a_string"
|
||||
- name: ENVVAR2
|
||||
value: "123"
|
||||
- name: ENVVAR3
|
||||
value: "false"
|
||||
|
||||
- it: should pass with addNvidiaRuntimeClass and nvidiaRuntimeClassName set
|
||||
documentIndex: *cronjobDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: CronJob
|
||||
schedule: "* * * * *"
|
||||
scaleGPU:
|
||||
something: blabla
|
||||
global:
|
||||
ixChartContext:
|
||||
addNvidiaRuntimeClass: true
|
||||
nvidiaRuntimeClassName: something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.runtimeClassName
|
||||
value: something
|
||||
|
||||
- it: should pass with deviceList set
|
||||
documentIndex: *cronjobDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: CronJob
|
||||
schedule: "* * * * *"
|
||||
deviceList:
|
||||
- enabled: true
|
||||
hostPath: /dev/usb
|
||||
mountPath: /host/dev/usb
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.jobTemplate.spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 568
|
||||
fsGroupChangePolicy: OnRootMismatch
|
||||
supplementalGroups:
|
||||
- 5
|
||||
- 10
|
||||
- 20
|
||||
- 24
|
||||
|
||||
- it: should pass with added persistence
|
||||
documentIndex: &cronjobDoc 3
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: CronJob
|
||||
schedule: "* * * * *"
|
||||
persistence:
|
||||
volume0:
|
||||
type: pvc
|
||||
enabled: true
|
||||
mountPath: /pvc/path
|
||||
volume1:
|
||||
enabled: true
|
||||
type: nfs
|
||||
server: some.server.local
|
||||
path: /nfs/path
|
||||
mountPath: /nfs
|
||||
volume2:
|
||||
enabled: true
|
||||
type: ixVolume
|
||||
datasetName: ix-app
|
||||
mountPath: /ixVol
|
||||
volume3:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: /mnt/pool/test
|
||||
mountPath: /some/path
|
||||
volume4:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
medium: Memory
|
||||
sizeLimit: 1Gi
|
||||
mountPath: /temp-path
|
||||
volume5:
|
||||
type: secret
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "0777"
|
||||
mountPath: /secret-path
|
||||
volume6:
|
||||
type: configMap
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "0777"
|
||||
mountPath: /configmap-path
|
||||
ixVolumes:
|
||||
- /mnt/pool/ix-applications/ix-app
|
||||
asserts:
|
||||
- isKind:
|
||||
of: CronJob
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- contains:
|
||||
path: spec.jobTemplate.spec.template.spec.volumes
|
||||
content:
|
||||
name: volume0
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME-common-test-volume0
|
||||
- contains:
|
||||
path: spec.jobTemplate.spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
nfs:
|
||||
path: /nfs/path
|
||||
server: some.server.local
|
||||
- contains:
|
||||
path: spec.jobTemplate.spec.template.spec.volumes
|
||||
content:
|
||||
name: volume2
|
||||
hostPath:
|
||||
path: /mnt/pool/ix-applications/ix-app
|
||||
- contains:
|
||||
path: spec.jobTemplate.spec.template.spec.volumes
|
||||
content:
|
||||
name: volume3
|
||||
hostPath:
|
||||
path: /mnt/pool/test
|
||||
- contains:
|
||||
path: spec.jobTemplate.spec.template.spec.volumes
|
||||
content:
|
||||
name: volume4
|
||||
emptyDir:
|
||||
medium: Memory
|
||||
sizeLimit: 1Gi
|
||||
- contains:
|
||||
path: spec.jobTemplate.spec.template.spec.volumes
|
||||
content:
|
||||
name: volume5
|
||||
secret:
|
||||
defaultMode: 511
|
||||
secretName: some_object_name
|
||||
- contains:
|
||||
path: spec.jobTemplate.spec.template.spec.volumes
|
||||
content:
|
||||
name: volume6
|
||||
configMap:
|
||||
defaultMode: 511
|
||||
name: some_object_name
|
||||
@@ -1,77 +0,0 @@
|
||||
suite: cronjob label test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &cronJobDoc 2
|
||||
set:
|
||||
controller:
|
||||
type: CronJob
|
||||
schedule: "*/5 * * * *"
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: CronJob
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with controller and global labels
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
some_key: some_value
|
||||
controller:
|
||||
type: CronJob
|
||||
schedule: "*/5 * * * *"
|
||||
labels:
|
||||
controller_key: controller_value
|
||||
controller_key2: "{{ .Values.some_key }}"
|
||||
global:
|
||||
labels:
|
||||
global_key: global_value
|
||||
global_key2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
controller_key: controller_value
|
||||
controller_key2: some_value
|
||||
global_key: global_value
|
||||
global_key2: some_value
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with podLabels set
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
controller:
|
||||
type: CronJob
|
||||
schedule: "*/5 * * * *"
|
||||
some_key: some_value2
|
||||
podLabels:
|
||||
test: some_value
|
||||
test2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels.test2
|
||||
value: some_value2
|
||||
- equal:
|
||||
path: metadata.labels.test
|
||||
value: some_value
|
||||
@@ -1,44 +0,0 @@
|
||||
suite: cronjob name test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &cronjobDoc 2
|
||||
set:
|
||||
controller:
|
||||
type: CronJob
|
||||
schedule: "* * * * *"
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: CronJob
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with nameOverride
|
||||
documentIndex: *cronjobDoc
|
||||
set:
|
||||
controller:
|
||||
type: CronJob
|
||||
schedule: "* * * * *"
|
||||
nameOverride: overrodename
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-overrodename
|
||||
|
||||
- it: should pass with global.nameOverride
|
||||
documentIndex: *cronjobDoc
|
||||
set:
|
||||
controller:
|
||||
type: CronJob
|
||||
schedule: "* * * * *"
|
||||
nameOverride: overrodename
|
||||
global:
|
||||
nameOverride: globaloverrodename
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-globaloverrodename
|
||||
@@ -1,66 +0,0 @@
|
||||
suite: daemonset annotation test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &daemonsetDoc 0
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: DaemonSet
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- matchRegex:
|
||||
path: spec.template.metadata.annotations.rollme
|
||||
pattern: "^[a-zA-Z0-9]{5}$"
|
||||
|
||||
- it: should pass with controller and global annotations
|
||||
documentIndex: *daemonsetDoc
|
||||
set:
|
||||
some_key: some_value
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
annotations:
|
||||
controller_key: controller_value
|
||||
controller_key2: "{{ .Values.some_key }}"
|
||||
global:
|
||||
annotations:
|
||||
global_key: global_value
|
||||
global_key2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
controller_key: controller_value
|
||||
controller_key2: some_value
|
||||
global_key: global_value
|
||||
global_key2: some_value
|
||||
- isNull:
|
||||
path: metadata.annotations.rollme
|
||||
- matchRegex:
|
||||
path: spec.template.metadata.annotations.rollme
|
||||
pattern: "^[a-zA-Z0-9]{5}$"
|
||||
|
||||
- it: should pass with podAnnotations set
|
||||
documentIndex: *daemonsetDoc
|
||||
set:
|
||||
some_key: some_value2
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
pod:
|
||||
annotations:
|
||||
test: some_value
|
||||
test2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.metadata.annotations
|
||||
content:
|
||||
test2: some_value2
|
||||
test: some_value
|
||||
@@ -1,67 +0,0 @@
|
||||
suite: daemonset strategy test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with strategy changed in DaemonSet
|
||||
documentIndex: &dameonsetDoc 0
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
strategy: OnDelete
|
||||
rollingUpdate:
|
||||
surge: 5
|
||||
unavailable: 6
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: DaemonSet
|
||||
- equal:
|
||||
path: spec.updateStrategy
|
||||
value:
|
||||
type: OnDelete
|
||||
- isNull:
|
||||
path: spec.updateStrategy.rollingUpdate
|
||||
|
||||
- it: should pass with strategy changed in DaemonSet
|
||||
documentIndex: *dameonsetDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
strategy: RollingUpdate
|
||||
rollingUpdate:
|
||||
surge: 5
|
||||
unavailable: 6
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.updateStrategy
|
||||
value:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxSurge: 5
|
||||
maxUnavailable: 6
|
||||
|
||||
- it: should fail with wrong strategy
|
||||
documentIndex: *dameonsetDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
strategy: not_valid_strategy
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Not a valid strategy type for DaemonSet (not_valid_strategy)
|
||||
|
||||
- it: should pass with revisionHistoryLimit changed
|
||||
documentIndex: *dameonsetDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
revisionHistoryLimit: 1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.revisionHistoryLimit
|
||||
value: 1
|
||||
@@ -1,119 +0,0 @@
|
||||
suite: daemonset default test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with controller set to DaemonSet
|
||||
documentIndex: &daemonsetDoc 0
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: DaemonSet
|
||||
- isAPIVersion:
|
||||
of: apps/v1
|
||||
- equal:
|
||||
path: spec.revisionHistoryLimit
|
||||
value: 3
|
||||
- equal:
|
||||
path: spec.updateStrategy.type
|
||||
value: RollingUpdate
|
||||
- equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: default
|
||||
- equal:
|
||||
path: spec.template.spec.hostNetwork
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.enableServiceLinks
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.terminationGracePeriodSeconds
|
||||
value: 10
|
||||
- isNull:
|
||||
path: spec.template.spec.hostname
|
||||
- equal:
|
||||
path: spec.template.spec.dnsPolicy
|
||||
value: ClusterFirst
|
||||
- isNull:
|
||||
path: spec.template.spec.dnsConfig
|
||||
- isNull:
|
||||
path: spec.template.spec.priorityClassName
|
||||
- isNull:
|
||||
path: spec.template.spec.schedulerName
|
||||
- isNull:
|
||||
path: spec.template.spec.hostAliases
|
||||
- isNull:
|
||||
path: spec.template.spec.nodeSelector
|
||||
- isNull:
|
||||
path: spec.template.spec.tolerations
|
||||
- isNull:
|
||||
path: spec.template.spec.imagePullSecrets
|
||||
- isNull:
|
||||
path: spec.template.spec.runtimeClassName
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].name
|
||||
value: RELEASE-NAME-common-test
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].image
|
||||
value: repo:tag
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].command
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].args
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].tty
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].stdin
|
||||
value: false
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].lifecycle
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].terminationMessagePath
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].terminationMessagePolicy
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 568
|
||||
fsGroupChangePolicy: OnRootMismatch
|
||||
supplementalGroups: []
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 568
|
||||
runAsGroup: 568
|
||||
capabilities:
|
||||
add: []
|
||||
drop:
|
||||
- ALL
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
value:
|
||||
- mountPath: /shared
|
||||
name: shared
|
||||
- mountPath: /tmp
|
||||
name: tmp
|
||||
- mountPath: /var/logs
|
||||
name: varlogs
|
||||
@@ -1,294 +0,0 @@
|
||||
suite: daemonset generic test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with controller set to DaemonSet
|
||||
documentIndex: &daemonsetDoc 0
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: DaemonSet
|
||||
- isAPIVersion:
|
||||
of: apps/v1
|
||||
|
||||
- it: should pass with podSecurityContext changed
|
||||
documentIndex: *daemonsetDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
pod:
|
||||
securityContext:
|
||||
fsGroup: 0
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 0
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
|
||||
- it: should pass with podSecurityContext changed from default
|
||||
documentIndex: *daemonsetDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
podSecurityContext:
|
||||
fsGroup: 0
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 0
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
|
||||
- it: should pass with podSecurityContext changed from default
|
||||
documentIndex: *daemonsetDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
capabilities:
|
||||
add:
|
||||
- something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
capabilities:
|
||||
add:
|
||||
- something
|
||||
drop:
|
||||
- ALL
|
||||
|
||||
- it: should pass with podSecurityContext changed
|
||||
documentIndex: *daemonsetDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
capabilities:
|
||||
add:
|
||||
- something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
capabilities:
|
||||
add:
|
||||
- something
|
||||
drop:
|
||||
- ALL
|
||||
|
||||
- it: should pass with multiple envs defined via tpl
|
||||
documentIndex: *daemonsetDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
pod:
|
||||
containers:
|
||||
main:
|
||||
env:
|
||||
ENVVAR: "{{ .Values.some_string }}"
|
||||
ENVVAR2: "{{ .Values.some_int }}"
|
||||
ENVVAR3: "{{ .Values.some_bool }}"
|
||||
some_string: a_string
|
||||
some_int: 123
|
||||
some_bool: false
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: ENVVAR
|
||||
value: "a_string"
|
||||
- name: ENVVAR2
|
||||
value: "123"
|
||||
- name: ENVVAR3
|
||||
value: "false"
|
||||
|
||||
- it: should pass with image defined in init containers
|
||||
documentIndex: *daemonsetDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
image:
|
||||
repository: some-repo
|
||||
tag: some-tag
|
||||
pullPolicy: Always
|
||||
someImage:
|
||||
repository: some-other-repo
|
||||
tag: some-other-tag
|
||||
pullPolicy: Never
|
||||
additionalContainers:
|
||||
some-name:
|
||||
imageSelector: someImage
|
||||
pullPolicy: Never
|
||||
initContainers:
|
||||
some-name:
|
||||
imageSelector: someImage
|
||||
pullPolicy: Never
|
||||
systemContainers:
|
||||
some-name:
|
||||
imageSelector: someImage
|
||||
pullPolicy: Never
|
||||
installContainers:
|
||||
some-name:
|
||||
imageSelector: someImage
|
||||
pullPolicy: Never
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0]
|
||||
content:
|
||||
image: some-repo:some-tag
|
||||
imagePullPolicy: Always
|
||||
- lengthEqual:
|
||||
path: spec.template.spec.containers
|
||||
count: 2
|
||||
- lengthEqual:
|
||||
path: spec.template.spec.initContainers
|
||||
count: 3
|
||||
|
||||
- it: should pass with added persistence
|
||||
documentIndex: *daemonsetDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
persistence:
|
||||
volume0:
|
||||
type: pvc
|
||||
enabled: true
|
||||
mountPath: /pvc/path
|
||||
volume1:
|
||||
enabled: true
|
||||
type: nfs
|
||||
server: some.server.local
|
||||
path: /nfs/path
|
||||
mountPath: /nfs
|
||||
volume2:
|
||||
enabled: true
|
||||
type: ixVolume
|
||||
datasetName: ix-app
|
||||
mountPath: /ixVol
|
||||
volume3:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: /mnt/pool/test
|
||||
mountPath: /some/path
|
||||
volume4:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
medium: Memory
|
||||
sizeLimit: 1Gi
|
||||
mountPath: /temp-path
|
||||
volume5:
|
||||
type: secret
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "0777"
|
||||
mountPath: /secret-path
|
||||
volume6:
|
||||
type: configMap
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "0777"
|
||||
mountPath: /configmap-path
|
||||
ixVolumes:
|
||||
- /mnt/pool/ix-applications/ix-app
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume0
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME-common-test-volume0
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
nfs:
|
||||
path: /nfs/path
|
||||
server: some.server.local
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume2
|
||||
hostPath:
|
||||
path: /mnt/pool/ix-applications/ix-app
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume3
|
||||
hostPath:
|
||||
path: /mnt/pool/test
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume4
|
||||
emptyDir:
|
||||
medium: Memory
|
||||
sizeLimit: 1Gi
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume5
|
||||
secret:
|
||||
defaultMode: 511
|
||||
secretName: some_object_name
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume6
|
||||
configMap:
|
||||
defaultMode: 511
|
||||
name: some_object_name
|
||||
@@ -1,85 +0,0 @@
|
||||
suite: daemonset label test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &daemonsetDoc 0
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: DaemonSet
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
- equal:
|
||||
path: spec.selector.matchLabels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: common-test
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with controller and global labels
|
||||
documentIndex: *daemonsetDoc
|
||||
set:
|
||||
some_key: some_value
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
labels:
|
||||
controller_key: controller_value
|
||||
controller_key2: "{{ .Values.some_key }}"
|
||||
global:
|
||||
labels:
|
||||
global_key: global_value
|
||||
global_key2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
controller_key: controller_value
|
||||
controller_key2: some_value
|
||||
global_key: global_value
|
||||
global_key2: some_value
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with podLabels set
|
||||
documentIndex: *daemonsetDoc
|
||||
set:
|
||||
some_key: some_value2
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
pod:
|
||||
labels:
|
||||
test: some_value
|
||||
test2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.metadata.labels.test2
|
||||
value: some_value2
|
||||
- equal:
|
||||
path: spec.template.metadata.labels.test
|
||||
value: some_value
|
||||
@@ -1,44 +0,0 @@
|
||||
suite: daemonset name test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &daemonsetDoc 0
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: DaemonSet
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with nameOverride
|
||||
documentIndex: *daemonsetDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
nameOverride: overrodename
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-overrodename
|
||||
|
||||
- it: should pass with global.nameOverride
|
||||
documentIndex: *daemonsetDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
nameOverride: overrodename
|
||||
global:
|
||||
nameOverride: globaloverrodename
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-globaloverrodename
|
||||
@@ -1,60 +0,0 @@
|
||||
suite: deployment annotation test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- matchRegex:
|
||||
path: spec.template.metadata.annotations.rollme
|
||||
pattern: "^[a-zA-Z0-9]{5}$"
|
||||
|
||||
- it: should pass with controller and global annotations
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_key: some_value
|
||||
controllers:
|
||||
main:
|
||||
annotations:
|
||||
controller_key: controller_value
|
||||
controller_key2: "{{ .Values.some_key }}"
|
||||
global:
|
||||
annotations:
|
||||
global_key: global_value
|
||||
global_key2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
controller_key: controller_value
|
||||
controller_key2: some_value
|
||||
global_key: global_value
|
||||
global_key2: some_value
|
||||
- isNull:
|
||||
path: metadata.annotations.rollme
|
||||
- matchRegex:
|
||||
path: spec.template.metadata.annotations.rollme
|
||||
pattern: "^[a-zA-Z0-9]{5}$"
|
||||
|
||||
- it: should pass with podAnnotations set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_key: some_value2
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
annotations:
|
||||
test: some_value
|
||||
test2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.metadata.annotations
|
||||
content:
|
||||
test2: some_value2
|
||||
test: some_value
|
||||
@@ -1,107 +0,0 @@
|
||||
suite: deployment controller test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- equal:
|
||||
path: apiVersion
|
||||
value: apps/v1
|
||||
- equal:
|
||||
path: spec.revisionHistoryLimit
|
||||
value: 3
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.strategy.type
|
||||
value: Recreate
|
||||
- isNull:
|
||||
path: spec.strategy.rollingUpdate
|
||||
|
||||
- it: should pass with controller disabled
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
enabled: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
|
||||
- it: should pass with controller strategy changed and rollingUpdate strategies set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
strategy: RollingUpdate
|
||||
rollingUpdate:
|
||||
unavailable: 2
|
||||
surge: 3
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.strategy.type
|
||||
value: RollingUpdate
|
||||
- equal:
|
||||
path: spec.strategy.rollingUpdate
|
||||
value:
|
||||
maxUnavailable: 2
|
||||
maxSurge: 3
|
||||
|
||||
- it: should pass with controller strategy changed
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
strategy: RollingUpdate
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.strategy.type
|
||||
value: RollingUpdate
|
||||
- isNull:
|
||||
path: spec.strategy.rollingUpdate
|
||||
|
||||
- it: should fail with wrong controller
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: not_valid_controller
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Not a valid controller.type (not_valid_controller). Valid options are Deployment, DaemonSet, StatefulSet, Job, CronJob
|
||||
|
||||
- it: should fail with wrong strategy
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
strategy: not_valid_strategy
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Not a valid strategy type for Deployment (not_valid_strategy)
|
||||
|
||||
- it: should pass with revisionHistoryLimit changed
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
revisionHistoryLimit: 1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.revisionHistoryLimit
|
||||
value: 1
|
||||
|
||||
- it: should pass with replicas changed
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
replicas: 6
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 6
|
||||
@@ -1,121 +0,0 @@
|
||||
suite: deployment default test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isAPIVersion:
|
||||
of: apps/v1
|
||||
- equal:
|
||||
path: spec.revisionHistoryLimit
|
||||
value: 3
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.strategy.type
|
||||
value: Recreate
|
||||
- equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: default
|
||||
- equal:
|
||||
path: spec.template.spec.hostNetwork
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.terminationGracePeriodSeconds
|
||||
value: 10
|
||||
- equal:
|
||||
path: spec.template.spec.enableServiceLinks
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.terminationGracePeriodSeconds
|
||||
value: 10
|
||||
- isNull:
|
||||
path: spec.template.spec.hostname
|
||||
- equal:
|
||||
path: spec.template.spec.dnsPolicy
|
||||
value: ClusterFirst
|
||||
- isNull:
|
||||
path: spec.template.spec.dnsConfig
|
||||
- isNull:
|
||||
path: spec.template.spec.priorityClassName
|
||||
- isNull:
|
||||
path: spec.template.spec.schedulerName
|
||||
- isNull:
|
||||
path: spec.template.spec.hostAliases
|
||||
- isNull:
|
||||
path: spec.template.spec.nodeSelector
|
||||
- isNull:
|
||||
path: spec.template.spec.tolerations
|
||||
- isNull:
|
||||
path: spec.template.spec.imagePullSecrets
|
||||
- isNull:
|
||||
path: spec.template.spec.runtimeClassName
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].name
|
||||
value: RELEASE-NAME-common-test
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].image
|
||||
value: repo:tag
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].command
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].args
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].tty
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].stdin
|
||||
value: false
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].lifecycle
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].terminationMessagePath
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].terminationMessagePolicy
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 568
|
||||
fsGroupChangePolicy: OnRootMismatch
|
||||
supplementalGroups: []
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 568
|
||||
runAsGroup: 568
|
||||
capabilities:
|
||||
add: []
|
||||
drop:
|
||||
- ALL
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
value:
|
||||
- mountPath: /shared
|
||||
name: shared
|
||||
- mountPath: /tmp
|
||||
name: tmp
|
||||
- mountPath: /var/logs
|
||||
name: varlogs
|
||||
@@ -1,401 +0,0 @@
|
||||
|
||||
suite: deployment dns-network test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should pass with hostNetwork set from default
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
hostNetwork: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.hostNetwork
|
||||
value: true
|
||||
|
||||
- it: should pass with hostNetwork set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
hostNetwork: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.hostNetwork
|
||||
value: true
|
||||
|
||||
- it: should pass with hostname set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
hostname: some_hostname
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.hostname
|
||||
value: some_hostname
|
||||
|
||||
- it: should pass with hostname set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
name: some_hostname
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
hostname: "{{ .Values.name }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.hostname
|
||||
value: some_hostname
|
||||
|
||||
- it: should pass with enableServiceLinks set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
enableServiceLinks: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.enableServiceLinks
|
||||
value: true
|
||||
|
||||
- it: should fail with invalid dnsPolicy
|
||||
set:
|
||||
dnsPolicy: invalid
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Not valid dnsPolicy (invalid). Valid options are ClusterFirst, Default, ClusterFirstWithHostNet, None
|
||||
|
||||
- it: should pass with changed dnsPolicy from default
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
dnsPolicy: Default
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.dnsPolicy
|
||||
value: Default
|
||||
|
||||
- it: should pass with changed dnsPolicy
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
dnsPolicy: Default
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.dnsPolicy
|
||||
value: Default
|
||||
|
||||
- it: should pass with hostNet dnsPolicy
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
hostNetwork: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.dnsPolicy
|
||||
value: ClusterFirstWithHostNet
|
||||
|
||||
- it: should pass with hostNet and changed dnsPolicy
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
dnsPolicy: Default
|
||||
hostNetwork: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.dnsPolicy
|
||||
value: Default
|
||||
|
||||
- it: should fail with more than 3 nameservers
|
||||
set:
|
||||
dnsConfig:
|
||||
nameservers:
|
||||
- ns1
|
||||
- ns2
|
||||
- ns3
|
||||
- ns4
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: There can be at most 3 nameservers specified in dnsConfig
|
||||
|
||||
- it: should fail with more than 6 domain searches
|
||||
set:
|
||||
dnsConfig:
|
||||
searches:
|
||||
- domain_search_1
|
||||
- domain_search_2
|
||||
- domain_search_3
|
||||
- domain_search_4
|
||||
- domain_search_5
|
||||
- domain_search_6
|
||||
- domain_search_7
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: There can be at most 6 search domains specified in dnsConfig
|
||||
|
||||
- it: should fail with no nameservers and dnsPolicy set to None
|
||||
set:
|
||||
dnsPolicy: None
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: With dnsPolicy set to None, you must specify at least 1 nameservers on dnsConfig
|
||||
|
||||
- it: should pass with dnsConfig defined from default
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
dnsConfig:
|
||||
nameservers:
|
||||
- ns1
|
||||
- ns2
|
||||
searches:
|
||||
- domain_search_1
|
||||
- domain_search_2
|
||||
options:
|
||||
- name: ndots
|
||||
value: 2
|
||||
- name: edns0
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.dnsConfig
|
||||
value:
|
||||
nameservers:
|
||||
- ns1
|
||||
- ns2
|
||||
searches:
|
||||
- domain_search_1
|
||||
- domain_search_2
|
||||
options:
|
||||
- name: ndots
|
||||
value: "2"
|
||||
- name: edns0
|
||||
|
||||
- it: should pass with dnsConfig defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
dnsConfig:
|
||||
nameservers:
|
||||
- ns1
|
||||
- ns2
|
||||
searches:
|
||||
- domain_search_1
|
||||
- domain_search_2
|
||||
options:
|
||||
- name: ndots
|
||||
value: 2
|
||||
- name: edns0
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.dnsConfig
|
||||
value:
|
||||
nameservers:
|
||||
- ns1
|
||||
- ns2
|
||||
searches:
|
||||
- domain_search_1
|
||||
- domain_search_2
|
||||
options:
|
||||
- name: ndots
|
||||
value: "2"
|
||||
- name: edns0
|
||||
|
||||
- it: should pass with dnsConfig nameservers only
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
dnsConfig:
|
||||
nameservers:
|
||||
- ns1
|
||||
- ns2
|
||||
- 1.1.1.1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.dnsConfig
|
||||
value:
|
||||
nameservers:
|
||||
- ns1
|
||||
- ns2
|
||||
- 1.1.1.1
|
||||
|
||||
- it: should pass with dnsConfig searches only
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
dnsConfig:
|
||||
searches:
|
||||
- domain_search_1
|
||||
- domain_search_2
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.dnsConfig
|
||||
value:
|
||||
searches:
|
||||
- domain_search_1
|
||||
- domain_search_2
|
||||
|
||||
- it: should pass with dnsConfig options only
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
dnsConfig:
|
||||
options:
|
||||
- name: ndots
|
||||
value: 2
|
||||
- name: edns0
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.dnsConfig
|
||||
value:
|
||||
options:
|
||||
- name: ndots
|
||||
value: "2"
|
||||
- name: edns0
|
||||
|
||||
- it: should pass with dnsConfig nameservers only from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
ns1: ns1
|
||||
dnsConfig:
|
||||
nameservers:
|
||||
- "{{ .Values.ns1 }}"
|
||||
- ns2
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.dnsConfig
|
||||
value:
|
||||
nameservers:
|
||||
- ns1
|
||||
- ns2
|
||||
|
||||
- it: should pass with dnsConfig searches only from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
ds: domain_search_1
|
||||
dnsConfig:
|
||||
searches:
|
||||
- "{{ .Values.ds }}"
|
||||
- domain_search_2
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.dnsConfig
|
||||
value:
|
||||
searches:
|
||||
- domain_search_1
|
||||
- domain_search_2
|
||||
|
||||
- it: should pass with dnsConfig options only from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
opt1_name: ndots
|
||||
opt1_value: 2
|
||||
opt2_name: edns0
|
||||
dnsConfig:
|
||||
options:
|
||||
- name: "{{ .Values.opt1_name }}"
|
||||
value: "{{ .Values.opt1_value }}"
|
||||
- name: "{{ .Values.opt2_name }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.dnsConfig
|
||||
value:
|
||||
options:
|
||||
- name: ndots
|
||||
value: "2"
|
||||
- name: edns0
|
||||
|
||||
- it: should fail without ip in hostAliases
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
hostAliases:
|
||||
- hostnames:
|
||||
- hostname1
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <ip> field is required in hostAliases
|
||||
|
||||
- it: should fail without hostnames in hostAliases
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
hostAliases:
|
||||
- ip: 1.1.1.1
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: At least one <hostnames> is required in hostAliases
|
||||
|
||||
- it: should pass with hostAliases defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
hostAliases:
|
||||
- ip: 1.1.1.1
|
||||
hostnames:
|
||||
- hostname1
|
||||
- hostname2
|
||||
- ip: 8.8.8.8
|
||||
hostnames:
|
||||
- hostname3
|
||||
- hostname4
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.hostAliases
|
||||
value:
|
||||
- ip: 1.1.1.1
|
||||
hostnames:
|
||||
- hostname1
|
||||
- hostname2
|
||||
- ip: 8.8.8.8
|
||||
hostnames:
|
||||
- hostname3
|
||||
- hostname4
|
||||
|
||||
- it: should pass with hostAliases defined from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
ip1: 1.1.1.1
|
||||
ip2: 8.8.8.8
|
||||
host1: hostname1
|
||||
host2: hostname2
|
||||
host3: hostname3
|
||||
host4: hostname4
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
hostAliases:
|
||||
- ip: "{{ .Values.ip1 }}"
|
||||
hostnames:
|
||||
- "{{ .Values.host1 }}"
|
||||
- "{{ .Values.host2 }}"
|
||||
- ip: "{{ .Values.ip2 }}"
|
||||
hostnames:
|
||||
- "{{ .Values.host3 }}"
|
||||
- "{{ .Values.host4 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.hostAliases
|
||||
value:
|
||||
- ip: 1.1.1.1
|
||||
hostnames:
|
||||
- hostname1
|
||||
- hostname2
|
||||
- ip: 8.8.8.8
|
||||
hostnames:
|
||||
- hostname3
|
||||
- hostname4
|
||||
@@ -1,79 +0,0 @@
|
||||
suite: deployment label test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
- equal:
|
||||
path: spec.selector.matchLabels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: common-test
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with controller and global labels
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_key: some_value
|
||||
controllers:
|
||||
main:
|
||||
labels:
|
||||
controller_key: controller_value
|
||||
controller_key2: "{{ .Values.some_key }}"
|
||||
global:
|
||||
labels:
|
||||
global_key: global_value
|
||||
global_key2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
controller_key: controller_value
|
||||
controller_key2: some_value
|
||||
global_key: global_value
|
||||
global_key2: some_value
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with podLabels set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_key: some_value2
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
labels:
|
||||
test: some_value
|
||||
test2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.metadata.labels.test2
|
||||
value: some_value2
|
||||
- equal:
|
||||
path: spec.template.metadata.labels.test
|
||||
value: some_value
|
||||
@@ -1,38 +0,0 @@
|
||||
suite: deployment name test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with nameOverride
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
nameOverride: overrodename
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-overrodename
|
||||
|
||||
- it: should pass with global.nameOverride
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
nameOverride: overrodename
|
||||
global:
|
||||
nameOverride: globaloverrodename
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-globaloverrodename
|
||||
@@ -1,109 +0,0 @@
|
||||
suite: deployment podSecurityContext test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 568
|
||||
fsGroupChangePolicy: OnRootMismatch
|
||||
supplementalGroups: []
|
||||
|
||||
- it: should pass with changed podSecurity values from default
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
podSecurityContext:
|
||||
fsGroup: 999
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 999
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
|
||||
- it: should pass with changed podSecurity values
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
securityContext:
|
||||
fsGroup: 999
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 999
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
|
||||
- it: should fail with invalid fsGroupChangePolicy
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
securityContext:
|
||||
fsGroupChangePolicy: invalid_policy
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid option for fsGroupChangePolicy. Valid options are <Always> and <OnRootMismatch>.
|
||||
|
||||
- it: should fail with empty fsGroupChangePolicy
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
securityContext:
|
||||
fsGroupChangePolicy:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <fsGroupChangePolicy> key cannot be empty. Set a value or remove the key for the default (OnRootMismatch) to take effect.
|
||||
|
||||
- it: should fail with empty fsGroup
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
securityContext:
|
||||
fsGroup:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <fsGroup> key cannot be empty. Set a value or remove the key for the default (568) to take effect.
|
||||
|
||||
- it: should fail with non-int fsGroup
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
securityContext:
|
||||
fsGroup: "1000"
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <fsGroup> key has value of ("1000"). But must be an int.
|
||||
|
||||
- it: should fail with empty supplementalGroups
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
securityContext:
|
||||
supplementalGroups:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <supplementalGroups> key has a value (<nil>). But it must be a list. Set a list value or remove the key for the default ([]) to take effect.
|
||||
@@ -1,95 +0,0 @@
|
||||
suite: deployment runtimeClassName test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: spec.template.spec.runtimeClassName
|
||||
|
||||
- it: should pass with addNvidiaRuntimeClass and nvidiaRuntimeClassName set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
scaleGPU:
|
||||
something: blabla
|
||||
global:
|
||||
ixChartContext:
|
||||
addNvidiaRuntimeClass: true
|
||||
nvidiaRuntimeClassName: something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.runtimeClassName
|
||||
value: something
|
||||
|
||||
- it: should pass with addNvidiaRuntimeClass and nvidiaRuntimeClassName set and gpu on initContainers
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
initContainers:
|
||||
some-name:
|
||||
scaleGPU:
|
||||
something: blabla
|
||||
global:
|
||||
ixChartContext:
|
||||
addNvidiaRuntimeClass: true
|
||||
nvidiaRuntimeClassName: something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.runtimeClassName
|
||||
value: something
|
||||
|
||||
- it: should pass overriding global and per pod runtime
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
runtimeClassName: perpod
|
||||
scaleGPU:
|
||||
something: blabla
|
||||
globalDefaults:
|
||||
runtimeClassName: global
|
||||
global:
|
||||
ixChartContext:
|
||||
addNvidiaRuntimeClass: true
|
||||
nvidiaRuntimeClassName: something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.runtimeClassName
|
||||
value: something
|
||||
|
||||
- it: should pass with nvidiaRuntimeClassName set but not addNvidiaRuntimeClassName
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
global:
|
||||
ixChartContext:
|
||||
nvidiaRuntimeClassName: something
|
||||
asserts:
|
||||
- isNull:
|
||||
path: spec.template.spec.runtimeClassName
|
||||
|
||||
- it: should pass with global runtime set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
globalDefaults:
|
||||
runtimeClassName: something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.runtimeClassName
|
||||
value: something
|
||||
|
||||
- it: should pass with pod runtime set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
runtimeClassName: something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.runtimeClassName
|
||||
value: something
|
||||
@@ -1,51 +0,0 @@
|
||||
|
||||
suite: deployment serviceAccountName
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should pass (have correct serviceAccountName) with service account enabled
|
||||
documentIndex: &deploymentDoc 1
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass (have correct serviceAccountName) with primary service account enabled and nameOverride defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
nameOverride: some-name
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: RELEASE-NAME-common-test-some-name
|
||||
|
||||
- it: should pass (have correct serviceAccountName) with non-primary service account enabled and nameOverride defined
|
||||
documentIndex: &deploymentDoc 2
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
other:
|
||||
enabled: true
|
||||
primary: false
|
||||
nameOverride: some-name
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: RELEASE-NAME-common-test
|
||||
@@ -1,470 +0,0 @@
|
||||
suite: deployment various options test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: spec.template.spec.runtimeClassName
|
||||
|
||||
- it: should pass with terminationGracePeriodSeconds set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
terminationGracePeriodSeconds: 25
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.terminationGracePeriodSeconds
|
||||
value: 25
|
||||
|
||||
- it: should pass with schedulerName set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
schedulerName: some_scheduler
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.schedulerName
|
||||
value: some_scheduler
|
||||
|
||||
- it: should pass with schedulerName set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
name: some_scheduler
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
schedulerName: "{{ .Values.name }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.schedulerName
|
||||
value: some_scheduler
|
||||
|
||||
- it: should pass with schedulerName set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
priorityClassName: some_priority_class_name
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.priorityClassName
|
||||
value: some_priority_class_name
|
||||
|
||||
- it: should pass with schedulerName set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
name: some_priority_class_name
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
priorityClassName: "{{ .Values.name }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.priorityClassName
|
||||
value: some_priority_class_name
|
||||
|
||||
- it: should pass with not set restartPolicy (default will be used)
|
||||
documentIndex: *deploymentDoc
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.restartPolicy
|
||||
value: Always
|
||||
|
||||
- it: should pass with set restartPolicy
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
restartPolicy: Always
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.restartPolicy
|
||||
value: Always
|
||||
|
||||
- it: should fail with invalid restartPolicy
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
restartPolicy: invalid
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid <restartPolicy> (invalid). Valid options are Always, Never, OnFailure
|
||||
|
||||
- it: should fail with invalid restartPolicy on Deployment
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: Deployment
|
||||
pod:
|
||||
restartPolicy: OnFailure
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid <restartPolicy (OnFailure). Valid option for Deployment, StatefulSet, DaemonSet is Always
|
||||
|
||||
- it: should fail with invalid restartPolicy on DaemonSet
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: DaemonSet
|
||||
pod:
|
||||
restartPolicy: OnFailure
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid <restartPolicy (OnFailure). Valid option for Deployment, StatefulSet, DaemonSet is Always
|
||||
|
||||
- it: should fail with invalid restartPolicy on StatefulSet
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
type: StatefulSet
|
||||
pod:
|
||||
restartPolicy: OnFailure
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid <restartPolicy (OnFailure). Valid option for Deployment, StatefulSet, DaemonSet is Always
|
||||
|
||||
- it: should fail with no value in a key in nodeSelector
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
nodeSelector:
|
||||
diskType:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Value is required on every key in <nodeSelector>
|
||||
|
||||
- it: should pass with nodeSelector set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
nodeSelector:
|
||||
diskType: ssd
|
||||
cpuType: intel
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.nodeSelector
|
||||
value:
|
||||
diskType: ssd
|
||||
cpuType: intel
|
||||
|
||||
- it: should pass with nodeSelector set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_key: ssd
|
||||
some_other_key: intel
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
nodeSelector:
|
||||
diskType: "{{ .Values.some_key }}"
|
||||
cpuType: "{{ .Values.some_other_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.nodeSelector
|
||||
value:
|
||||
diskType: ssd
|
||||
cpuType: intel
|
||||
|
||||
- it: should fail with invalid operator in tolerations
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- operator: invalid_op
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid <operator>. Valid options are Exists, Equal.
|
||||
|
||||
- it: should fail with invalid effect in tolerations
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- effect: invalid_effect
|
||||
operator: Exists
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid <effect> (invalid_effect). Valid options are NoExecute, NoSchedule, PreferNoSchedule
|
||||
|
||||
- it: should fail with empty key and operator Equal in tolerations
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- key: ""
|
||||
operator: Equal
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <key> is required when <operator> is set to <Equal>
|
||||
|
||||
- it: should fail with operator Exists and defined value in tolerations
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- value: something
|
||||
operator: Exists
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: When <operator> is set to <Exists>, you cannot define a <value>
|
||||
|
||||
- it: should fail with operator Exists and non-integer tolerationSeconds in tolerations
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- tolerationSeconds: not_an_int
|
||||
operator: Exists
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <tolerationSeconds> must result to an integer.
|
||||
|
||||
- it: should pass with tolerations defined, with tolerationSeconds set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
tolerationSeconds: 6000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.tolerations
|
||||
value:
|
||||
- operator: Exists
|
||||
tolerationSeconds: 6000
|
||||
|
||||
- it: should pass with tolerations defined, with only operator Exists
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.tolerations
|
||||
value:
|
||||
- operator: Exists
|
||||
|
||||
- it: should pass with tolerations defined, with only operator Exists from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
op: Exists
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- operator: "{{ .Values.op }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.tolerations
|
||||
value:
|
||||
- operator: Exists
|
||||
|
||||
- it: should pass with tolerations defined, with only operator Equal and key defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- operator: Equal
|
||||
key: key1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.tolerations
|
||||
value:
|
||||
- operator: Equal
|
||||
key: key1
|
||||
|
||||
- it: should pass with tolerations defined, with only operator Equal and key defined from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_key: key1
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- operator: Equal
|
||||
key: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.tolerations
|
||||
value:
|
||||
- operator: Equal
|
||||
key: key1
|
||||
|
||||
- it: should pass with tolerations defined, with operator Exists and effect defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
effect: NoExecute
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.tolerations
|
||||
value:
|
||||
- operator: Exists
|
||||
effect: NoExecute
|
||||
|
||||
- it: should pass with tolerations defined, with operator Exists and effect defined from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
ef1: NoExecute
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
effect: "{{ .Values.ef1 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.tolerations
|
||||
value:
|
||||
- operator: Exists
|
||||
effect: NoExecute
|
||||
|
||||
- it: should pass with tolerations defined, with operator Equal and value defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- operator: Equal
|
||||
value: some_value
|
||||
key: key1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.tolerations
|
||||
value:
|
||||
- operator: Equal
|
||||
value: some_value
|
||||
key: key1
|
||||
|
||||
- it: should pass with tolerations defined, with operator Equal and value defined from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
val: some_value
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- operator: Equal
|
||||
value: "{{ .Values.val }}"
|
||||
key: key1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.tolerations
|
||||
value:
|
||||
- operator: Equal
|
||||
value: some_value
|
||||
key: key1
|
||||
|
||||
- it: should pass with tolerations defined, with operator Equal and value defined from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
val: some_value
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- operator: Equal
|
||||
value: "{{ .Values.val }}"
|
||||
key: key1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.tolerations
|
||||
value:
|
||||
- operator: Equal
|
||||
value: some_value
|
||||
key: key1
|
||||
|
||||
- it: should pass with tolerations defined, with everything set, multiple entries
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- operator: Equal
|
||||
value: some_value
|
||||
key: key1
|
||||
effect: NoExecute
|
||||
tolerationSeconds: 6000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.tolerations
|
||||
value:
|
||||
- operator: Equal
|
||||
value: some_value
|
||||
key: key1
|
||||
effect: NoExecute
|
||||
tolerationSeconds: 6000
|
||||
|
||||
- it: should pass with tolerations defined, with everything set from tpl, multiple entries
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
op1: Equal
|
||||
val1: some_value1
|
||||
k1: key1
|
||||
ef1: NoExecute
|
||||
op2: Equal
|
||||
val2: some_value2
|
||||
k2: key2
|
||||
ef2: NoSchedule
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
tolerations:
|
||||
- operator: "{{ .Values.op1 }}"
|
||||
value: "{{ .Values.val1 }}"
|
||||
key: "{{ .Values.k1 }}"
|
||||
effect: "{{ .Values.ef1 }}"
|
||||
tolerationSeconds: 6000
|
||||
- operator: "{{ .Values.op2 }}"
|
||||
value: "{{ .Values.val2 }}"
|
||||
key: "{{ .Values.k2 }}"
|
||||
effect: "{{ .Values.ef2 }}"
|
||||
tolerationSeconds: 6000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.tolerations
|
||||
value:
|
||||
- operator: Equal
|
||||
value: some_value1
|
||||
key: key1
|
||||
effect: NoExecute
|
||||
tolerationSeconds: 6000
|
||||
- operator: Equal
|
||||
value: some_value2
|
||||
key: key2
|
||||
effect: NoSchedule
|
||||
tolerationSeconds: 6000
|
||||
@@ -1,207 +0,0 @@
|
||||
suite: deployment configMap volume test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: spec.template.spec.volume
|
||||
|
||||
- it: should fail with not set objectName on configMap
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: configMap
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: objectName not set for persistence item some_volume
|
||||
|
||||
- it: should fail with not set objectName on configmap
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: configMap
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: objectName not set for persistence item some_volume
|
||||
|
||||
- it: should fail with not set objectName on configMap
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: configMap
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: objectName not set for persistence item some_volume
|
||||
|
||||
- it: should pass with added configMap
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: configMap
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
configMap:
|
||||
name: some_object_name
|
||||
|
||||
- it: should fail with added configMap and defaultMode as int
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: configMap
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: 0777
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <defaultMode> (511, converted to octal) is not valid format. Valid format is string with 4 digits <0777>.
|
||||
|
||||
- it: should pass with added configMap and defaultMode as string
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: configMap
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "0777"
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
configMap:
|
||||
name: some_object_name
|
||||
defaultMode: 0777
|
||||
|
||||
- it: should fail with added configMap and defaultMode as int from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
mode: 644
|
||||
persistence:
|
||||
some_volume:
|
||||
type: configMap
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "{{ .Values.mode }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <defaultMode> (644, converted to octal) is not valid format. Valid format is string with 4 digits <0777>.
|
||||
|
||||
- it: should pass with added configMap and defaultMode as string from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
mode: "0644"
|
||||
persistence:
|
||||
some_volume:
|
||||
type: configMap
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "{{ .Values.mode }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
configMap:
|
||||
name: some_object_name
|
||||
defaultMode: 0644
|
||||
|
||||
- it: should pass with added configMap and items
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: configMap
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
items:
|
||||
- key: some_key
|
||||
path: some_path
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
configMap:
|
||||
name: some_object_name
|
||||
items:
|
||||
- key: some_key
|
||||
path: some_path
|
||||
|
||||
- it: should fail with added configMap and no key on items
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: configMap
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
items:
|
||||
- path: some_path
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: No key was given for persistence item some_volume
|
||||
|
||||
- it: should fail with added configMap and no path on items
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: configMap
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
items:
|
||||
- key: some_key
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: No path was given for persistence item some_volume
|
||||
|
||||
- it: should pass with added configMap and items from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
key: some_key
|
||||
path: some_path
|
||||
persistence:
|
||||
some_volume:
|
||||
type: configMap
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
items:
|
||||
- key: "{{ .Values.key }}"
|
||||
path: "{{ .Values.path }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
configMap:
|
||||
name: some_object_name
|
||||
items:
|
||||
- key: some_key
|
||||
path: some_path
|
||||
@@ -1,112 +0,0 @@
|
||||
suite: deployment custom volume test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: spec.template.spec.volume
|
||||
|
||||
- it: should fail with custom type but empty volumeSpec
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: custom
|
||||
enabled: true
|
||||
mountPath: /container
|
||||
volumeSpec: {}
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: You have defined custom persistence type but no <volumeSpec> was given on item (some_volume)
|
||||
|
||||
- it: should pass with custom type volume from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
k1: value1
|
||||
name: some_name
|
||||
persistence:
|
||||
some_volume:
|
||||
type: custom
|
||||
enabled: true
|
||||
mountPath: /container
|
||||
volumeSpec:
|
||||
arbitraryKey: value
|
||||
someDict:
|
||||
k1: "{{ .Values.k1 }}"
|
||||
k2: value2
|
||||
someList:
|
||||
- name: "{{ .Values.name }}"
|
||||
something: test
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
arbitraryKey: value
|
||||
someDict:
|
||||
k1: value1
|
||||
k2: value2
|
||||
someList:
|
||||
- name: some_name
|
||||
something: test
|
||||
|
||||
- it: should pass with multiple custom type volume from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
v1: value1
|
||||
v2: value2
|
||||
name1: some_name1
|
||||
name2: some_name2
|
||||
persistence:
|
||||
some_volume:
|
||||
type: custom
|
||||
enabled: true
|
||||
mountPath: /container
|
||||
volumeSpec:
|
||||
arbitraryKey: value
|
||||
someDict:
|
||||
k1: "{{ .Values.v1 }}"
|
||||
k2: value
|
||||
someList:
|
||||
- name: "{{ .Values.name1 }}"
|
||||
something: test
|
||||
some_volume2:
|
||||
type: custom
|
||||
enabled: true
|
||||
mountPath: /container
|
||||
volumeSpec:
|
||||
arbitraryKey: value
|
||||
someDict:
|
||||
k1: "{{ .Values.v2 }}"
|
||||
k2: value
|
||||
someList:
|
||||
- name: "{{ .Values.name2 }}"
|
||||
something: test
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
arbitraryKey: value
|
||||
someDict:
|
||||
k1: value1
|
||||
k2: value
|
||||
someList:
|
||||
- name: some_name1
|
||||
something: test
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume2
|
||||
arbitraryKey: value
|
||||
someDict:
|
||||
k1: value2
|
||||
k2: value
|
||||
someList:
|
||||
- name: some_name2
|
||||
something: test
|
||||
@@ -1,114 +0,0 @@
|
||||
suite: deployment emptyDir volume test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: spec.template.spec.volume
|
||||
|
||||
- it: should pass with added emptyDir volume
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
sizeLimit: 1Gi
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
emptyDir:
|
||||
sizeLimit: 1Gi
|
||||
|
||||
- it: should pass with added emptyDir volume and no sizeLimit
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
emptyDir: {}
|
||||
|
||||
- it: should pass with added emptyDir volume memory backed with sizeLimit
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
medium: Memory
|
||||
sizeLimit: 1Gi
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
emptyDir:
|
||||
medium: Memory
|
||||
sizeLimit: 1Gi
|
||||
|
||||
- it: should pass with added emptyDir volume memory backed with sizeLimit via tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_medium: Memory
|
||||
some_size: 1Gi
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
medium: "{{ .Values.some_medium }}"
|
||||
sizeLimit: "{{ .Values.some_size }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
emptyDir:
|
||||
medium: Memory
|
||||
sizeLimit: 1Gi
|
||||
|
||||
- it: should pass with added emptyDir volume memory backed and no sizeLimit
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
medium: Memory
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
emptyDir:
|
||||
medium: Memory
|
||||
|
||||
- it: should fail with added emptyDir and non Memory medium
|
||||
set:
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
medium: not_memory
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: You can only set <medium> as Memory on item (volume1)
|
||||
@@ -1,280 +0,0 @@
|
||||
suite: deployment hostPath volume test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: spec.template.spec.volume
|
||||
|
||||
- it: should fail with not set path on hostPath
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: hostPath
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: hostPath not set on item (some_volume)
|
||||
|
||||
- it: should fail with hostPath not starting with /
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: hostPath
|
||||
enabled: true
|
||||
mountPath: /some/path
|
||||
hostPath: some/relative/path
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Host path (some/relative/path) on item (some_volume) must start with a forward slash -> / <-
|
||||
|
||||
- it: should fail with ValidateHostPath globally set on and invalid hostPath (/mnt/pool)
|
||||
set:
|
||||
globalDefaults:
|
||||
validateHostPath: true
|
||||
persistence:
|
||||
some_volume:
|
||||
type: hostPath
|
||||
enabled: true
|
||||
noMount: true
|
||||
hostPath: /mnt/pool
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid hostPath (/mnt/pool). Allowed hostPaths are valid paths under a given pool. e.g. /mnt/POOL/DATASET, /mnt/POOL/DATASET/DIRECTORY
|
||||
|
||||
- it: should fail with ValidateHostPath globally set on and invalid hostPath (/cluster/ctdb_shared_vol)
|
||||
set:
|
||||
globalDefaults:
|
||||
validateHostPath: true
|
||||
persistence:
|
||||
some_volume:
|
||||
type: hostPath
|
||||
enabled: true
|
||||
noMount: true
|
||||
hostPath: /cluster/ctdb_shared_vol
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid hostPath (/cluster/ctdb_shared_vol). Allowed hostPaths are valid paths under a given pool. e.g. /mnt/POOL/DATASET, /mnt/POOL/DATASET/DIRECTORY
|
||||
|
||||
- it: should fail with ValidateHostPath globally set on and invalid hostPath (/not_allowed_path)
|
||||
set:
|
||||
globalDefaults:
|
||||
validateHostPath: true
|
||||
persistence:
|
||||
some_volume:
|
||||
type: hostPath
|
||||
enabled: true
|
||||
noMount: true
|
||||
hostPath: /not_allowed_path
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid hostPath (/not_allowed_path). Allowed hostPaths are valid paths under a given pool. e.g. /mnt/POOL/DATASET, /mnt/POOL/DATASET/DIRECTORY
|
||||
|
||||
- it: should fail with ValidateHostPath set on the persistence item and invalid hostPath (/mnt/pool)
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: hostPath
|
||||
enabled: true
|
||||
noMount: true
|
||||
hostPath: /mnt/pool
|
||||
validateHostPath: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid hostPath (/mnt/pool). Allowed hostPaths are valid paths under a given pool. e.g. /mnt/POOL/DATASET, /mnt/POOL/DATASET/DIRECTORY
|
||||
|
||||
- it: should fail with ValidateHostPath set on the persistence item and invalid hostPath (/cluster/ctdb_shared_vol)
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: hostPath
|
||||
enabled: true
|
||||
noMount: true
|
||||
hostPath: /cluster/ctdb_shared_vol
|
||||
validateHostPath: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid hostPath (/cluster/ctdb_shared_vol). Allowed hostPaths are valid paths under a given pool. e.g. /mnt/POOL/DATASET, /mnt/POOL/DATASET/DIRECTORY
|
||||
|
||||
- it: should fail with ValidateHostPath set on the persistence item and invalid hostPath (/not_allowed_path)
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: hostPath
|
||||
enabled: true
|
||||
noMount: true
|
||||
hostPath: /not_allowed_path
|
||||
validateHostPath: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid hostPath (/not_allowed_path). Allowed hostPaths are valid paths under a given pool. e.g. /mnt/POOL/DATASET, /mnt/POOL/DATASET/DIRECTORY
|
||||
|
||||
- it: should fail with ValidateHostPath globally disabled but enabled on the item and invalid hostPath (/not_allowed_path)
|
||||
set:
|
||||
globalDefaults:
|
||||
validateHostPath: false
|
||||
persistence:
|
||||
some_volume:
|
||||
type: hostPath
|
||||
enabled: true
|
||||
noMount: true
|
||||
hostPath: /not_allowed_path
|
||||
validateHostPath: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid hostPath (/not_allowed_path). Allowed hostPaths are valid paths under a given pool. e.g. /mnt/POOL/DATASET, /mnt/POOL/DATASET/DIRECTORY
|
||||
|
||||
- it: should fail with added hostPath and invalid hostPathType set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
hostType: invalid
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: /some_path
|
||||
hostPathType: "{{ .Values.hostType }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid <hostPathType> option (invalid) on item (volume1). Valid options are DirectoryOrCreate, Directory, FileOrCreate, File, Socket, CharDevice and BlockDevice
|
||||
|
||||
- it: should pass with ValidateHostPath globally enabled but disabled on the item and not allowed path for hostPath (/not_allowed_path)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
globalDefaults:
|
||||
validateHostPath: true
|
||||
persistence:
|
||||
some_volume:
|
||||
type: hostPath
|
||||
enabled: true
|
||||
noMount: true
|
||||
hostPath: /not_allowed_path
|
||||
validateHostPath: false
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
hostPath:
|
||||
path: /not_allowed_path
|
||||
|
||||
- it: should pass with added hostPath and validation globally enabled (/mnt/pool/dataset)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
globalDefaults:
|
||||
validateHostPath: true
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: /mnt/pool/test
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
hostPath:
|
||||
path: /mnt/pool/test
|
||||
|
||||
- it: should pass with added hostPath and validation globally enabled (/cluster/something)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
globalDefaults:
|
||||
validateHostPath: true
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: /cluster/something
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
hostPath:
|
||||
path: /cluster/something
|
||||
|
||||
- it: should pass with added hostPath and validation globally enabled (/sys)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
globalDefaults:
|
||||
validateHostPath: true
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: /sys
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
hostPath:
|
||||
path: /sys
|
||||
|
||||
- it: should pass with added hostPath and validation globally enabled (/dev)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
globalDefaults:
|
||||
validateHostPath: true
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: /dev
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
hostPath:
|
||||
path: /dev
|
||||
|
||||
- it: should pass with added hostPath
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: /mnt/pool/test
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
hostPath:
|
||||
path: /mnt/pool/test
|
||||
|
||||
- it: should pass with added hostPath and hostPathType set via tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
some_key: Directory
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPathType: "{{ .Values.some_key }}"
|
||||
hostPath: /mnt/pool/test
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
hostPath:
|
||||
path: /mnt/pool/test
|
||||
type: Directory
|
||||
@@ -1,145 +0,0 @@
|
||||
suite: deployment ixVolumes volume test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: spec.template.spec.volume
|
||||
|
||||
- it: should fail without set datasetName on ixVolume type
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: ixVolume
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Item (some_volume) is set as ixVolume type, but has no <datasetName> defined
|
||||
|
||||
- it: should fail with set datasetName on ixVolume type but empty ixVolumes
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: ixVolume
|
||||
datasetName: ix-app
|
||||
enabled: true
|
||||
noMount: true
|
||||
ixVolumes: []
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Key <ixVolumes> is empty. But persistence volumes of type ixVolumes is defined.
|
||||
|
||||
- it: should fail on ixVolume type with datasetName set but missing path in ixVolumes
|
||||
set:
|
||||
ixVolumes:
|
||||
- /mnt/pool/ix-applications/ix-other-app
|
||||
persistence:
|
||||
some_volume:
|
||||
type: ixVolume
|
||||
datasetName: ix-app
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Dataset Name (ix-app) on item (some_volume) does not exist in ixVolumes list
|
||||
|
||||
- it: should fail on ixVolume type with hostPath set
|
||||
set:
|
||||
ixVolumes:
|
||||
- /mnt/pool/ix-applications/ix-app
|
||||
persistence:
|
||||
some_volume:
|
||||
type: ixVolume
|
||||
datasetName: ix-app
|
||||
hostPath: /mnt/pool/test
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Item (some_volume), is set as ixVolume but has hostPath defined. This is automatically calculated.
|
||||
|
||||
- it: should fail with added ixVolume and invalid hostPathType set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
hostType: invalid
|
||||
ixVolumes:
|
||||
- /mnt/pool/ix-applications/ix-app
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: ixVolume
|
||||
datasetName: ix-app
|
||||
hostPathType: "{{ .Values.hostType }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid <hostPathType> option (invalid) on item (volume1). Valid options are DirectoryOrCreate, Directory, FileOrCreate, File, Socket, CharDevice and BlockDevice
|
||||
|
||||
- it: should pass with added ixVolume
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
ixVolumes:
|
||||
- /mnt/pool/ix-applications/ix-app
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: ixVolume
|
||||
datasetName: ix-app
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
hostPath:
|
||||
path: /mnt/pool/ix-applications/ix-app
|
||||
|
||||
- it: should pass with added ixVolume and hostPathType set
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
ixVolumes:
|
||||
- /mnt/pool/ix-applications/ix-app
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: ixVolume
|
||||
datasetName: ix-app
|
||||
hostPathType: Directory
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
hostPath:
|
||||
path: /mnt/pool/ix-applications/ix-app
|
||||
type: Directory
|
||||
|
||||
- it: should pass with added ixVolume and hostPathType set from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
hostType: Directory
|
||||
ixVolumes:
|
||||
- /mnt/pool/ix-applications/ix-app
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: ixVolume
|
||||
datasetName: ix-app
|
||||
hostPathType: "{{ .Values.hostType }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
hostPath:
|
||||
path: /mnt/pool/ix-applications/ix-app
|
||||
type: Directory
|
||||
@@ -1,68 +0,0 @@
|
||||
suite: deployment nfs volume test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: spec.template.spec.volume
|
||||
|
||||
- it: should pass with added nfs
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: nfs
|
||||
server: some.server.local
|
||||
path: /nfs/path
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
nfs:
|
||||
server: some.server.local
|
||||
path: /nfs/path
|
||||
|
||||
- it: should fail with not set server on nfs
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: nfs
|
||||
enabled: true
|
||||
path: /some_path
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: NFS Server not set on item some_volume
|
||||
|
||||
- it: should fail with path not starting with /
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: nfs
|
||||
enabled: true
|
||||
path: some/relative/path
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: NFS path (some/relative/path) on (some_volume) must start with a forward slash -> / <-
|
||||
|
||||
- it: should fail with not set path on nfs
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: nfs
|
||||
enabled: true
|
||||
server: some_server
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: NFS Path not set on item some_volume
|
||||
@@ -1,134 +0,0 @@
|
||||
suite: deployment pvc volume test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: spec.template.spec.volume
|
||||
|
||||
- it: should pass with added PVC
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: pvc
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME-common-test-some_volume
|
||||
|
||||
- it: should pass with added PVC and existingClaim
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: pvc
|
||||
enabled: true
|
||||
existingClaim: some_existing_claim
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
persistentVolumeClaim:
|
||||
claimName: some_existing_claim
|
||||
|
||||
- it: should pass with added PVC and existingClaim from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
claim: some_existing_claim
|
||||
persistence:
|
||||
some_volume:
|
||||
type: pvc
|
||||
enabled: true
|
||||
existingClaim: "{{ .Values.claim }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
persistentVolumeClaim:
|
||||
claimName: some_existing_claim
|
||||
|
||||
- it: should pass with added PVC and nameOverride
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: pvc
|
||||
enabled: true
|
||||
nameOverride: some_claim
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME-common-test-some_claim
|
||||
|
||||
- it: should pass with added PVC and nameOverride from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
claim: some_claim
|
||||
persistence:
|
||||
some_volume:
|
||||
type: pvc
|
||||
enabled: true
|
||||
nameOverride: "{{ .Values.claim }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME-common-test-some_claim
|
||||
|
||||
- it: should pass with added PVC and forceName
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: pvc
|
||||
enabled: true
|
||||
forceName: forced_name
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
persistentVolumeClaim:
|
||||
claimName: forced_name
|
||||
|
||||
- it: should pass with added PVC and forceName from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
claim: forced_name
|
||||
persistence:
|
||||
some_volume:
|
||||
type: pvc
|
||||
enabled: true
|
||||
forceName: "{{ .Values.claim }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
persistentVolumeClaim:
|
||||
claimName: forced_name
|
||||
@@ -1,197 +0,0 @@
|
||||
suite: deployment secret volume test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: spec.template.spec.volume
|
||||
|
||||
- it: should fail with not set objectName on secret
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: secret
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: objectName not set for persistence item some_volume
|
||||
|
||||
- it: should fail with not set objectName on secret
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: secret
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: objectName not set for persistence item some_volume
|
||||
|
||||
- it: should pass with added secret
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: secret
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
documentIndex: *deploymentDoc
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
secret:
|
||||
secretName: some_object_name
|
||||
|
||||
- it: should fail with added secret and defaultMode as int
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: secret
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: 0777
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <defaultMode> (511, converted to octal) is not valid format. Valid format is string with 4 digits <0777>.
|
||||
|
||||
- it: should pass with added secret and defaultMode as string
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: secret
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "0777"
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
secret:
|
||||
secretName: some_object_name
|
||||
defaultMode: 0777
|
||||
|
||||
- it: should fail with added secret and defaultMode as int from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
mode: 644
|
||||
persistence:
|
||||
some_volume:
|
||||
type: secret
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "{{ .Values.mode }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <defaultMode> (644, converted to octal) is not valid format. Valid format is string with 4 digits <0777>.
|
||||
|
||||
- it: should pass with added secret and defaultMode as string from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
mode: "0644"
|
||||
persistence:
|
||||
some_volume:
|
||||
type: secret
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "{{ .Values.mode }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
secret:
|
||||
secretName: some_object_name
|
||||
defaultMode: 0644
|
||||
|
||||
- it: should fail with added secret and no key on items
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: secret
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
items:
|
||||
- path: some_path
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: No key was given for persistence item some_volume
|
||||
|
||||
- it: should fail with added secret and no path on items
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: secret
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
items:
|
||||
- key: some_key
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: No path was given for persistence item some_volume
|
||||
|
||||
- it: should pass with added secret and items
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: secret
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
items:
|
||||
- key: some_key
|
||||
path: some_path
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
secret:
|
||||
secretName: some_object_name
|
||||
items:
|
||||
- key: some_key
|
||||
path: some_path
|
||||
|
||||
- it: should pass with added secret and items from tpl
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
key: some_key
|
||||
path: some_path
|
||||
persistence:
|
||||
some_volume:
|
||||
type: secret
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
items:
|
||||
- key: "{{ .Values.key }}"
|
||||
path: "{{ .Values.path }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some_volume
|
||||
secret:
|
||||
secretName: some_object_name
|
||||
items:
|
||||
- key: some_key
|
||||
path: some_path
|
||||
@@ -1,24 +0,0 @@
|
||||
suite: deployment volume test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: spec.template.spec.volume
|
||||
|
||||
- it: should fail with wrong persistence type
|
||||
set:
|
||||
persistence:
|
||||
some_volume:
|
||||
type: not_valid_persistence
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Not a valid persistence.type (not_valid_persistence)
|
||||
@@ -1,405 +0,0 @@
|
||||
suite: external interfaces test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail without hostInterface
|
||||
set:
|
||||
externalInterfaces:
|
||||
- hostInterface: ""
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <hostInterface> is required when configuring External Interfaces.
|
||||
|
||||
- it: should fail without ipam type
|
||||
set:
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam: {}
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <ipam.type> is required. Interface (ens3s0)
|
||||
|
||||
- it: should fail with invalid ipam type
|
||||
set:
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: invalid_type
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid option for <ipam.type> (invalid_type). Valid options are static and dhcp. Interface (ens3s0)
|
||||
|
||||
- it: should fail with dhcp ipam and staticIPConfigurations
|
||||
set:
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: dhcp
|
||||
staticIPConfigurations:
|
||||
- 1.1.1.1
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <staticIPConfigurations> and <staticRoutes> cannot be used with <ipam.type> of (dhcp). Interface (ens3s0)
|
||||
|
||||
- it: should fail with dhcp ipam and staticRoutes
|
||||
set:
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: dhcp
|
||||
staticRoutes:
|
||||
- gateway: 1.1.1.1
|
||||
destination: 1.1.1.1
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <staticIPConfigurations> and <staticRoutes> cannot be used with <ipam.type> of (dhcp). Interface (ens3s0)
|
||||
|
||||
- it: should fail with static ipam and no staticIPConfigurations
|
||||
set:
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: static
|
||||
staticIPConfigurations: []
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Static IP is required when <ipam.type> is static. Interface (ens3s0)
|
||||
|
||||
- it: should fail with static ipam and no staticRoutes.gateway
|
||||
set:
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: static
|
||||
staticIPConfigurations:
|
||||
- 1.1.1.1
|
||||
staticRoutes:
|
||||
- gateway: ""
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <destination> and <gateway> are required when <staticRoutes> are defined. Interface (ens3s0)
|
||||
|
||||
- it: should fail with static ipam and no staticRoutes.destination
|
||||
set:
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: static
|
||||
staticIPConfigurations:
|
||||
- 1.1.1.1
|
||||
staticRoutes:
|
||||
- gateway: 1.1.1.1
|
||||
destination: ""
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <destination> and <gateway> are required when <staticRoutes> are defined. Interface (ens3s0)
|
||||
|
||||
- it: should fail with ixExternalInterfacesConfiguration empty
|
||||
documentIndex: &externalInterfaceDoc 0
|
||||
set:
|
||||
# Only to pass validation
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: dhcp
|
||||
# Simulate the ix Injected values
|
||||
ixExternalInterfacesConfiguration:
|
||||
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: There are externalInterfaces defined, but key <ixExternalInterfaceConfigurationNames> is empty.
|
||||
|
||||
- it: should pass with externalInterface defined
|
||||
documentIndex: &externalInterfaceDoc 0
|
||||
set:
|
||||
# Only to pass validation
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: dhcp
|
||||
# Simulate the ix Injected values
|
||||
ixExternalInterfacesConfiguration:
|
||||
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
|
||||
ixExternalInterfacesConfigurationNames:
|
||||
- ix-RELEASE-NAME-0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- isKind:
|
||||
of: NetworkAttachmentDefinition
|
||||
- isAPIVersion:
|
||||
of: k8s.cni.cncf.io/v1
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
config: '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: ix-RELEASE-NAME-0
|
||||
|
||||
- it: should pass with externalInterface defined (annotation check)
|
||||
documentIndex: &deploymentDoc 1
|
||||
set:
|
||||
# Only to pass validation
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: dhcp
|
||||
# Simulate the ix Injected values
|
||||
ixExternalInterfacesConfiguration:
|
||||
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
|
||||
ixExternalInterfacesConfigurationNames:
|
||||
- ix-RELEASE-NAME-0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- isSubset:
|
||||
path: spec.template.metadata.annotations
|
||||
content:
|
||||
k8s.v1.cni.cncf.io/networks: ix-RELEASE-NAME-0
|
||||
- matchRegex:
|
||||
path: spec.template.metadata.annotations.rollme
|
||||
pattern: "^[a-zA-Z0-9]{5}$"
|
||||
|
||||
- it: should pass with externalInterface defined, multiple entries (First Doc)
|
||||
documentIndex: *externalInterfaceDoc
|
||||
set:
|
||||
# Only to pass validation
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: dhcp
|
||||
# Simulate the ix Injected values
|
||||
ixExternalInterfacesConfiguration:
|
||||
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
|
||||
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-1", "type": "macvlan", "master": "ens5s0", "ipam": {"type": "dhcp"}}'
|
||||
ixExternalInterfacesConfigurationNames:
|
||||
- ix-RELEASE-NAME-0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: NetworkAttachmentDefinition
|
||||
- isAPIVersion:
|
||||
of: k8s.cni.cncf.io/v1
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
config: '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: ix-RELEASE-NAME-0
|
||||
|
||||
- it: should pass with externalInterface defined, multiple entries (Second Doc)
|
||||
documentIndex: &otherExternalInterfaceDoc 1
|
||||
set:
|
||||
# Only to pass validation
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: dhcp
|
||||
# Simulate the ix Injected values
|
||||
ixExternalInterfacesConfiguration:
|
||||
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
|
||||
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-1", "type": "macvlan", "master": "ens5s0", "ipam": {"type": "dhcp"}}'
|
||||
ixExternalInterfacesConfigurationNames:
|
||||
- ix-RELEASE-NAME-0
|
||||
- ix-RELEASE-NAME-1
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: NetworkAttachmentDefinition
|
||||
- isAPIVersion:
|
||||
of: k8s.cni.cncf.io/v1
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
config: '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-1", "type": "macvlan", "master": "ens5s0", "ipam": {"type": "dhcp"}}'
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: ix-RELEASE-NAME-1
|
||||
|
||||
- it: should pass with externalInterface defined, multiple entries (annotation check)
|
||||
documentIndex: &deploymentDoc 2
|
||||
set:
|
||||
# Only to pass validation
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: dhcp
|
||||
# Simulate the ix Injected values
|
||||
ixExternalInterfacesConfiguration:
|
||||
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
|
||||
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-1", "type": "macvlan", "master": "ens5s0", "ipam": {"type": "dhcp"}}'
|
||||
ixExternalInterfacesConfigurationNames:
|
||||
- ix-RELEASE-NAME-0
|
||||
- ix-RELEASE-NAME-1
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- isSubset:
|
||||
path: spec.template.metadata.annotations
|
||||
content:
|
||||
k8s.v1.cni.cncf.io/networks: ix-RELEASE-NAME-0, ix-RELEASE-NAME-1
|
||||
- matchRegex:
|
||||
path: spec.template.metadata.annotations.rollme
|
||||
pattern: "^[a-zA-Z0-9]{5}$"
|
||||
|
||||
- it: should pass with externalInterface defined and global annotations, multiple entries
|
||||
documentIndex: &externalInterfaceDoc 0
|
||||
set:
|
||||
global:
|
||||
annotations:
|
||||
key1: value1
|
||||
key2: value2
|
||||
# Only to pass validation
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: dhcp
|
||||
# Simulate the ix Injected values
|
||||
ixExternalInterfacesConfiguration:
|
||||
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
|
||||
ixExternalInterfacesConfigurationNames:
|
||||
- ix-RELEASE-NAME-0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- isKind:
|
||||
of: NetworkAttachmentDefinition
|
||||
- isAPIVersion:
|
||||
of: k8s.cni.cncf.io/v1
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
key1: value1
|
||||
key2: value2
|
||||
|
||||
- it: should pass with externalInterface defined and global annotations from tpl, multiple entries
|
||||
documentIndex: &externalInterfaceDoc 0
|
||||
set:
|
||||
k1: value1
|
||||
k2: value2
|
||||
global:
|
||||
annotations:
|
||||
key1: "{{ .Values.k1 }}"
|
||||
key2: "{{ .Values.k2 }}"
|
||||
# Only to pass validation
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: dhcp
|
||||
# Simulate the ix Injected values
|
||||
ixExternalInterfacesConfiguration:
|
||||
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
|
||||
ixExternalInterfacesConfigurationNames:
|
||||
- ix-RELEASE-NAME-0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- isKind:
|
||||
of: NetworkAttachmentDefinition
|
||||
- isAPIVersion:
|
||||
of: k8s.cni.cncf.io/v1
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
key1: value1
|
||||
key2: value2
|
||||
|
||||
- it: should pass with externalInterface defined and global labels, multiple entries
|
||||
documentIndex: &externalInterfaceDoc 0
|
||||
set:
|
||||
global:
|
||||
labels:
|
||||
key1: value1
|
||||
key2: value2
|
||||
# Only to pass validation
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: dhcp
|
||||
# Simulate the ix Injected values
|
||||
ixExternalInterfacesConfiguration:
|
||||
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
|
||||
ixExternalInterfacesConfigurationNames:
|
||||
- ix-RELEASE-NAME-0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- isKind:
|
||||
of: NetworkAttachmentDefinition
|
||||
- isAPIVersion:
|
||||
of: k8s.cni.cncf.io/v1
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
key1: value1
|
||||
key2: value2
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with externalInterface defined and global labels from tpl, multiple entries
|
||||
documentIndex: &externalInterfaceDoc 0
|
||||
set:
|
||||
k1: value1
|
||||
k2: value2
|
||||
global:
|
||||
labels:
|
||||
key1: "{{ .Values.k1 }}"
|
||||
key2: "{{ .Values.k2 }}"
|
||||
# Only to pass validation
|
||||
externalInterfaces:
|
||||
- hostInterface: ens3s0
|
||||
ipam:
|
||||
type: dhcp
|
||||
# Simulate the ix Injected values
|
||||
ixExternalInterfacesConfiguration:
|
||||
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
|
||||
ixExternalInterfacesConfigurationNames:
|
||||
- ix-RELEASE-NAME-0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- isKind:
|
||||
of: NetworkAttachmentDefinition
|
||||
- isAPIVersion:
|
||||
of: k8s.cni.cncf.io/v1
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
key1: value1
|
||||
key2: value2
|
||||
release: RELEASE-NAME
|
||||
@@ -1,416 +0,0 @@
|
||||
suite: image pull secrets test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail without name in imagePullCredentials
|
||||
set:
|
||||
imagePullCredentials:
|
||||
- enabled: true
|
||||
content:
|
||||
registry: quay.io
|
||||
username: some_name
|
||||
password: some_password
|
||||
email: someone@example.com
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <name> is required for Image Pull Secrets Credentials
|
||||
|
||||
- it: should fail without content in imagePullCredentials
|
||||
set:
|
||||
imagePullCredentials:
|
||||
- name: registry-creds
|
||||
enabled: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <content> is not defined in Image Pull Secrets Credential (registry-creds)
|
||||
|
||||
- it: should fail without registry in imagePullCredentials
|
||||
set:
|
||||
imagePullCredentials:
|
||||
- name: registry-creds
|
||||
enabled: true
|
||||
content:
|
||||
username: some_name
|
||||
password: some_password
|
||||
email: someone@example.com
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <registry> is not defined in Image Pull Secrets Credential (registry-creds)
|
||||
|
||||
- it: should fail without email in imagePullCredentials
|
||||
set:
|
||||
imagePullCredentials:
|
||||
- name: registry-creds
|
||||
enabled: true
|
||||
content:
|
||||
username: some_name
|
||||
password: some_password
|
||||
registry: quay.io
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <email> is not defined in Image Pull Secrets Credential (registry-creds)
|
||||
|
||||
- it: should fail without username in imagePullCredentials
|
||||
set:
|
||||
imagePullCredentials:
|
||||
- name: registry-creds
|
||||
enabled: true
|
||||
content:
|
||||
password: some_password
|
||||
registry: quay.io
|
||||
email: someone@example.com
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <username> is not defined in Image Pull Secrets Credential (registry-creds)
|
||||
|
||||
- it: should fail without password in imagePullCredentials
|
||||
set:
|
||||
imagePullCredentials:
|
||||
- name: registry-creds
|
||||
enabled: true
|
||||
content:
|
||||
username: some_name
|
||||
registry: quay.io
|
||||
email: someone@example.com
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <password> is not defined in Image Pull Secrets Credential (registry-creds)
|
||||
|
||||
- it: should fail with special characters in name in imagePullCredentials
|
||||
set:
|
||||
imagePullCredentials:
|
||||
- name: registry-creds!!!
|
||||
enabled: true
|
||||
content:
|
||||
username: some_name
|
||||
registry: quay.io
|
||||
email: someone@example.com
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <name> (registry-creds!!!) can only container this alphanumerical characters (- a-z A-Z 0-9)
|
||||
|
||||
- it: should pass with imagePullCredentials defined and super long name
|
||||
documentIndex: &secretDoc 0
|
||||
set:
|
||||
imagePullCredentials:
|
||||
- name: thisNameIsSuperLong-1111111111111111111111111-ItsStillGoing22222222222222-SOMEMORE
|
||||
enabled: true
|
||||
content:
|
||||
registry: quay.io
|
||||
username: some_name
|
||||
password: some_password
|
||||
email: someone@example.com
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-thisnameissuperlong-111111111111111111
|
||||
|
||||
- it: should pass with imagePullCredentials defined (Secret)
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
imagePullCredentials:
|
||||
- name: registry-creds
|
||||
enabled: true
|
||||
content:
|
||||
registry: quay.io
|
||||
username: some_name
|
||||
password: some_password
|
||||
email: someone@example.com
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/dockerconfigjson
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-registry-creds
|
||||
- isNotEmpty:
|
||||
path: data.\.dockerconfigjson
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with imagePullCredentials defined (Deployment)
|
||||
documentIndex: &deploymentDoc 1
|
||||
set:
|
||||
imagePullCredentials:
|
||||
- name: registry-creds
|
||||
enabled: true
|
||||
content:
|
||||
registry: quay.io
|
||||
username: some_name
|
||||
password: some_password
|
||||
email: someone@example.com
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- equal:
|
||||
path: spec.template.spec.imagePullSecrets
|
||||
value:
|
||||
- name: RELEASE-NAME-common-test-registry-creds
|
||||
|
||||
- it: should pass with multiple imagePullCredentials defined (Secret 1/2)
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
imagePullCredentials:
|
||||
- name: registry-creds
|
||||
enabled: true
|
||||
content:
|
||||
registry: quay.io
|
||||
username: some_name
|
||||
password: some_password
|
||||
email: someone@example.com
|
||||
- name: registry-creds2
|
||||
enabled: true
|
||||
content:
|
||||
registry: quay.io2
|
||||
username: some_name2
|
||||
password: some_password2
|
||||
email: someone@example.com2
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/dockerconfigjson
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-registry-creds
|
||||
- isNotEmpty:
|
||||
path: data.\.dockerconfigjson
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with multiple imagePullCredentials defined (Secret 2/2)
|
||||
documentIndex: &secondSecretDoc 1
|
||||
set:
|
||||
imagePullCredentials:
|
||||
- name: registry-creds
|
||||
enabled: true
|
||||
content:
|
||||
registry: quay.io
|
||||
username: some_name
|
||||
password: some_password
|
||||
email: someone@example.com
|
||||
- name: registry-creds2
|
||||
enabled: true
|
||||
content:
|
||||
registry: quay.io2
|
||||
username: some_name2
|
||||
password: some_password2
|
||||
email: someone@example.com2
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/dockerconfigjson
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-registry-creds2
|
||||
- isNotEmpty:
|
||||
path: data.\.dockerconfigjson
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with imagePullCredentials defined (Deployment)
|
||||
documentIndex: &deploymentDoc 2
|
||||
set:
|
||||
imagePullCredentials:
|
||||
- name: registry-creds
|
||||
enabled: true
|
||||
content:
|
||||
registry: quay.io
|
||||
username: some_name
|
||||
password: some_password
|
||||
email: someone@example.com
|
||||
- name: registry-creds2
|
||||
enabled: true
|
||||
content:
|
||||
registry: quay.io2
|
||||
username: some_name2
|
||||
password: some_password2
|
||||
email: someone@example.com2
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- equal:
|
||||
path: spec.template.spec.imagePullSecrets
|
||||
value:
|
||||
- name: RELEASE-NAME-common-test-registry-creds
|
||||
- name: RELEASE-NAME-common-test-registry-creds2
|
||||
|
||||
- it: should pass with imagePullCredentials defined and global annotations
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
global:
|
||||
annotations:
|
||||
key1: value1
|
||||
key2: value2
|
||||
imagePullCredentials:
|
||||
- name: registry-creds
|
||||
enabled: true
|
||||
content:
|
||||
registry: quay.io
|
||||
username: some_name
|
||||
password: some_password
|
||||
email: someone@example.com
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-registry-creds
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
key1: value1
|
||||
key2: value2
|
||||
|
||||
- it: should pass with imagePullCredentials defined and global annotations from tpl
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
k1: value1
|
||||
k2: value2
|
||||
global:
|
||||
annotations:
|
||||
key1: "{{ .Values.k1 }}"
|
||||
key2: "{{ .Values.k2 }}"
|
||||
imagePullCredentials:
|
||||
- name: registry-creds
|
||||
enabled: true
|
||||
content:
|
||||
registry: quay.io
|
||||
username: some_name
|
||||
password: some_password
|
||||
email: someone@example.com
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-registry-creds
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
key1: value1
|
||||
key2: value2
|
||||
|
||||
- it: should pass with imagePullCredentials defined and global labels
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
global:
|
||||
labels:
|
||||
key1: value1
|
||||
key2: value2
|
||||
imagePullCredentials:
|
||||
- name: registry-creds
|
||||
enabled: true
|
||||
content:
|
||||
registry: quay.io
|
||||
username: some_name
|
||||
password: some_password
|
||||
email: someone@example.com
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-registry-creds
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
key1: value1
|
||||
key2: value2
|
||||
|
||||
- it: should pass with imagePullCredentials defined and global labels from tpl
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
k1: value1
|
||||
k2: value2
|
||||
global:
|
||||
labels:
|
||||
key1: "{{ .Values.k1 }}"
|
||||
key2: "{{ .Values.k2 }}"
|
||||
imagePullCredentials:
|
||||
- name: registry-creds
|
||||
enabled: true
|
||||
content:
|
||||
registry: quay.io
|
||||
username: some_name
|
||||
password: some_password
|
||||
email: someone@example.com
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-registry-creds
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
key1: value1
|
||||
key2: value2
|
||||
-1326
File diff suppressed because it is too large
Load Diff
-1225
File diff suppressed because it is too large
Load Diff
-1227
File diff suppressed because it is too large
Load Diff
-1239
File diff suppressed because it is too large
Load Diff
-1225
File diff suppressed because it is too large
Load Diff
-1242
File diff suppressed because it is too large
Load Diff
@@ -1,54 +0,0 @@
|
||||
suite: job annotation test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &jobDoc 2
|
||||
set:
|
||||
controller.type: Job
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Job
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
|
||||
- it: should pass with controller and global annotations
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
some_key: some_value
|
||||
controller:
|
||||
type: Job
|
||||
annotations:
|
||||
controller_key: controller_value
|
||||
controller_key2: "{{ .Values.some_key }}"
|
||||
global:
|
||||
annotations:
|
||||
global_key: global_value
|
||||
global_key2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: metadata.annotations
|
||||
content:
|
||||
controller_key: controller_value
|
||||
controller_key2: some_value
|
||||
global_key: global_value
|
||||
global_key2: some_value
|
||||
- isNull:
|
||||
path: metadata.annotations.rollme
|
||||
|
||||
- it: should pass with podAnnotations set
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controller.type: Job
|
||||
some_key: some_value2
|
||||
podAnnotations:
|
||||
test: some_value
|
||||
test2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: metadata.annotations
|
||||
content:
|
||||
test2: some_value2
|
||||
test: some_value
|
||||
@@ -1,36 +0,0 @@
|
||||
suite: job strategy test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with strategy changed in job
|
||||
documentIndex: &jobDoc 2
|
||||
set:
|
||||
controller:
|
||||
type: Job
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Job
|
||||
|
||||
- it: should pass with job options changed in job
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controller:
|
||||
type: Job
|
||||
backoffLimit: 11
|
||||
ttlSecondsAfterFinished: 22
|
||||
activeDeadlineSeconds: 33
|
||||
parallelism: 44
|
||||
completions: 55
|
||||
completionMode: Indexed
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
backoffLimit: 11
|
||||
ttlSecondsAfterFinished: 22
|
||||
activeDeadlineSeconds: 33
|
||||
parallelism: 44
|
||||
completions: 55
|
||||
completionMode: Indexed
|
||||
@@ -1,135 +0,0 @@
|
||||
suite: job default test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with controller set to Job
|
||||
documentIndex: &jobDoc 2
|
||||
set:
|
||||
controller.type: Job
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Job
|
||||
- isAPIVersion:
|
||||
of: batch/v1
|
||||
- equal:
|
||||
path: spec.backoffLimit
|
||||
value: 6
|
||||
- isNull:
|
||||
path: spec.ttlSecondsAfterFinished
|
||||
- isNull:
|
||||
path: spec.activeDeadlineSeconds
|
||||
- isNull:
|
||||
path: spec.parallelism
|
||||
- isNull:
|
||||
path: spec.completions
|
||||
- equal:
|
||||
path: spec.completionMode
|
||||
value: NonIndexed
|
||||
- equal:
|
||||
path: spec.template.spec.hostNetwork
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.enableServiceLinks
|
||||
value: false
|
||||
- isNull:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
- equal:
|
||||
path: spec.template.spec.restartPolicy
|
||||
value: Never
|
||||
- isNull:
|
||||
path: spec.template.spec.schedulerName
|
||||
- isNull:
|
||||
path: spec.template.spec.priorityClassName
|
||||
- isNull:
|
||||
path: spec.template.spec.hostname
|
||||
- isNull:
|
||||
path: spec.template.spec.dnsPolicy
|
||||
- isNull:
|
||||
path: spec.template.spec.dnsConfig
|
||||
- isNull:
|
||||
path: spec.template.spec.hostAliases
|
||||
- isNull:
|
||||
path: spec.template.spec.nodeSelector
|
||||
- isNull:
|
||||
path: spec.template.spec.tolerations
|
||||
- isNull:
|
||||
path: spec.template.spec.imagePullSecrets
|
||||
- isNull:
|
||||
path: spec.template.spec.runtimeClassName
|
||||
- equal:
|
||||
path: spec.template.spec.terminationGracePeriodSeconds
|
||||
value: 10
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].name
|
||||
value: RELEASE-NAME-common-test-job-main
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].image
|
||||
value: repo:tag
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].command
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].args
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].tty
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].stdin
|
||||
value: false
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].lifecycle
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].terminationMessagePath
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].terminationMessagePolicy
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 568
|
||||
fsGroupChangePolicy: OnRootMismatch
|
||||
supplementalGroups: []
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 568
|
||||
runAsGroup: 568
|
||||
capabilities:
|
||||
add: []
|
||||
drop:
|
||||
- ALL
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
value:
|
||||
- mountPath: /shared
|
||||
name: shared
|
||||
- mountPath: /tmp
|
||||
name: tmp
|
||||
- mountPath: /var/logs
|
||||
name: varlogs
|
||||
- equal:
|
||||
path: spec.template.spec.volumes
|
||||
value:
|
||||
- name: shared
|
||||
emptyDir: {}
|
||||
- name: tmp
|
||||
emptyDir: {}
|
||||
- name: varlogs
|
||||
emptyDir: {}
|
||||
@@ -1,230 +0,0 @@
|
||||
suite: job generic test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with controller set to Job
|
||||
documentIndex: &jobDoc 2
|
||||
set:
|
||||
controller:
|
||||
type: Job
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Job
|
||||
- isAPIVersion:
|
||||
of: batch/v1
|
||||
|
||||
- it: should pass with podSecurityContext changed
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controller:
|
||||
type: Job
|
||||
podSecurityContext:
|
||||
fsGroup: 0
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 0
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
|
||||
- it: should pass with podSecurityContext changed
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controller:
|
||||
type: Job
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
capabilities:
|
||||
add:
|
||||
- something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
capabilities:
|
||||
add:
|
||||
- something
|
||||
drop:
|
||||
- ALL
|
||||
|
||||
- it: should pass with multiple envs defined via tpl
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controller:
|
||||
type: Job
|
||||
some_string: a_string
|
||||
some_int: 123
|
||||
some_bool: false
|
||||
env:
|
||||
ENVVAR: "{{ .Values.some_string }}"
|
||||
ENVVAR2: "{{ .Values.some_int }}"
|
||||
ENVVAR3: "{{ .Values.some_bool }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: ENVVAR
|
||||
value: "a_string"
|
||||
- name: ENVVAR2
|
||||
value: "123"
|
||||
- name: ENVVAR3
|
||||
value: "false"
|
||||
|
||||
- it: should pass with addNvidiaRuntimeClass and nvidiaRuntimeClassName set
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controller:
|
||||
type: Job
|
||||
scaleGPU:
|
||||
something: blabla
|
||||
global:
|
||||
ixChartContext:
|
||||
addNvidiaRuntimeClass: true
|
||||
nvidiaRuntimeClassName: something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.runtimeClassName
|
||||
value: something
|
||||
|
||||
- it: should pass with deviceList set
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controller:
|
||||
type: Job
|
||||
deviceList:
|
||||
- enabled: true
|
||||
hostPath: /dev/usb
|
||||
mountPath: /host/dev/usb
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 568
|
||||
fsGroupChangePolicy: OnRootMismatch
|
||||
supplementalGroups:
|
||||
- 5
|
||||
- 10
|
||||
- 20
|
||||
- 24
|
||||
|
||||
- it: should pass with added persistence
|
||||
documentIndex: &jobDoc 3
|
||||
set:
|
||||
controller:
|
||||
type: Job
|
||||
persistence:
|
||||
volume0:
|
||||
type: pvc
|
||||
enabled: true
|
||||
mountPath: /pvc/path
|
||||
volume1:
|
||||
enabled: true
|
||||
type: nfs
|
||||
server: some.server.local
|
||||
path: /nfs/path
|
||||
mountPath: /nfs
|
||||
volume2:
|
||||
enabled: true
|
||||
type: ixVolume
|
||||
datasetName: ix-app
|
||||
mountPath: /ixVol
|
||||
volume3:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: /mnt/pool/test
|
||||
mountPath: /some/path
|
||||
volume4:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
medium: Memory
|
||||
sizeLimit: 1Gi
|
||||
mountPath: /temp-path
|
||||
volume5:
|
||||
type: secret
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "0777"
|
||||
mountPath: /secret-path
|
||||
volume6:
|
||||
type: configMap
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "0777"
|
||||
mountPath: /configmap-path
|
||||
ixVolumes:
|
||||
- /mnt/pool/ix-applications/ix-app
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Job
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume0
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME-common-test-volume0
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
nfs:
|
||||
path: /nfs/path
|
||||
server: some.server.local
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume2
|
||||
hostPath:
|
||||
path: /mnt/pool/ix-applications/ix-app
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume3
|
||||
hostPath:
|
||||
path: /mnt/pool/test
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume4
|
||||
emptyDir:
|
||||
medium: Memory
|
||||
sizeLimit: 1Gi
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume5
|
||||
secret:
|
||||
defaultMode: 511
|
||||
secretName: some_object_name
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume6
|
||||
configMap:
|
||||
defaultMode: 511
|
||||
name: some_object_name
|
||||
@@ -1,72 +0,0 @@
|
||||
suite: job label test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &jobDoc 2
|
||||
set:
|
||||
controller.type: Job
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Job
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with controller and global labels
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controller.type: Job
|
||||
some_key: some_value
|
||||
controller:
|
||||
labels:
|
||||
controller_key: controller_value
|
||||
controller_key2: "{{ .Values.some_key }}"
|
||||
global:
|
||||
labels:
|
||||
global_key: global_value
|
||||
global_key2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
controller_key: controller_value
|
||||
controller_key2: some_value
|
||||
global_key: global_value
|
||||
global_key2: some_value
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with podLabels set
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controller.type: Job
|
||||
some_key: some_value2
|
||||
podLabels:
|
||||
test: some_value
|
||||
test2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels.test2
|
||||
value: some_value2
|
||||
- equal:
|
||||
path: metadata.labels.test
|
||||
value: some_value
|
||||
@@ -1,38 +0,0 @@
|
||||
suite: job name test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &jobDoc 2
|
||||
set:
|
||||
controller.type: Job
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Job
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with nameOverride
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controller.type: Job
|
||||
nameOverride: overrodename
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-overrodename
|
||||
|
||||
- it: should pass with global.nameOverride
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controller.type: Job
|
||||
nameOverride: overrodename
|
||||
global:
|
||||
nameOverride: globaloverrodename
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-globaloverrodename
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,476 +0,0 @@
|
||||
suite: cronJobs test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail without schedule in cronjobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <cron.schedule> is required in <job> (job-name)
|
||||
|
||||
- it: should fail with non-string schedule in cronjobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: 1
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <cron.schedule> must be a string in <job> (job-name)
|
||||
|
||||
- it: should fail with non-string timezone in cronjobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
timezone: 2
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <cron.timezone> must be a string in <job> (job-name). Leave empty to use the default (UTC)
|
||||
|
||||
- it: should fail with invalid concurrencyPolicy in cronjobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
concurrencyPolicy: invalid
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid option (invalid) for <cron.concurrencyPolicy> in <job> (job-name). Valid options are Allow, Forbid, Replace. Leave empty to use the default (Forbid)
|
||||
|
||||
- it: should fail with negative value in failedJobsHistoryLimit in cronjobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
failedJobsHistoryLimit: -1
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <cron.failedJobsHistoryLimit> (-1) in <job> (job-name) must be a positive integer. Leave empty to use (1)
|
||||
|
||||
- it: should fail with negative value in successfulJobsHistoryLimit in cronjobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
successfulJobsHistoryLimit: -1
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <cron.successfulJobsHistoryLimit> (-1) in <job> (job-name) must be a positive integer. Leave empty to use (3)
|
||||
|
||||
- it: should fail with zero value in startingDeadlineSeconds in cronjobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
startingDeadlineSeconds: 0
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Zero value in <cron.startingDeadlineSeconds> (0) in <job> (job-name) is not allowed.
|
||||
|
||||
- it: should fail with negative value in startingDeadlineSeconds in cronjobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
startingDeadlineSeconds: -1
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <cron.startingDeadlineSeconds> (-1) in <job> (job-name) must be a positive integer.
|
||||
|
||||
- it: should pass with cronjob disabled
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: false
|
||||
cron:
|
||||
enabled: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
|
||||
- it: should pass with cronjob defined
|
||||
documentIndex: &cronJobDoc 3
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isKind:
|
||||
of: CronJob
|
||||
- isAPIVersion:
|
||||
of: batch/v1
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-job-name
|
||||
|
||||
- it: should pass with nameOverride in cronjob defined
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
nameOverride: other-job-name
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-other-job-name
|
||||
|
||||
- it: should pass with global labels and labels from tpl defined in cronjob
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
l1: val1
|
||||
l2: val2
|
||||
global:
|
||||
labels:
|
||||
label1: val3
|
||||
label2: val4
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
labels:
|
||||
l1: "{{ .Values.l1 }}"
|
||||
l2: "{{ .Values.l2 }}"
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
release: RELEASE-NAME
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
l1: val1
|
||||
l2: val2
|
||||
label1: val3
|
||||
label2: val4
|
||||
|
||||
- it: should pass with annotations from tpl defined in cronjob
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
a1: val1
|
||||
a2: val2
|
||||
global:
|
||||
annotations:
|
||||
annotation1: val3
|
||||
annotation2: val4
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
annotations:
|
||||
a1: "{{ .Values.a1 }}"
|
||||
a2: "{{ .Values.a2 }}"
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
a1: val1
|
||||
a2: val2
|
||||
annotation1: val3
|
||||
annotation2: val4
|
||||
|
||||
- it: should pass with defaults in cronjob
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
schedule: "* * * * *"
|
||||
timeZone: UTC
|
||||
concurrencyPolicy: Forbid
|
||||
failedJobsHistoryLimit: 1
|
||||
successfulJobsHistoryLimit: 3
|
||||
|
||||
- it: should pass with defaults in multiple cronjob (1/2)
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
other-job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isKind:
|
||||
of: CronJob
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-job-name
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
schedule: "* * * * *"
|
||||
timeZone: UTC
|
||||
concurrencyPolicy: Forbid
|
||||
failedJobsHistoryLimit: 1
|
||||
successfulJobsHistoryLimit: 3
|
||||
|
||||
- it: should pass with defaults in multiple cronjob (2/2)
|
||||
documentIndex: &otherCronJobDoc 4
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
other-job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isKind:
|
||||
of: CronJob
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-other-job-name
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
schedule: "* * * * *"
|
||||
timeZone: UTC
|
||||
concurrencyPolicy: Forbid
|
||||
failedJobsHistoryLimit: 1
|
||||
successfulJobsHistoryLimit: 3
|
||||
|
||||
- it: should pass with schedule defined defined in cronjob
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.schedule
|
||||
value: "* * * * *"
|
||||
|
||||
- it: should pass with timezone defined in cronjob
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
timezone: Europe/Athens
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.timeZone
|
||||
value: Europe/Athens
|
||||
|
||||
- it: should pass with concurrencyPolicy defined in cronjob
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
concurrencyPolicy: Allow
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.concurrencyPolicy
|
||||
value: Allow
|
||||
|
||||
- it: should pass with failedJobsHistoryLimit defined in cronjob
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
failedJobsHistoryLimit: 5
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.failedJobsHistoryLimit
|
||||
value: 5
|
||||
|
||||
- it: should pass with successfulJobsHistoryLimit defined in cronjob
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
successfulJobsHistoryLimit: 5
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.successfulJobsHistoryLimit
|
||||
value: 5
|
||||
|
||||
- it: should pass with startingDeadlineSeconds defined in cronjob
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
startingDeadlineSeconds: 150
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.startingDeadlineSeconds
|
||||
value: 150
|
||||
|
||||
- it: should pass with values set in jobTemplate
|
||||
documentIndex: *cronJobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
cron:
|
||||
enabled: true
|
||||
schedule: "* * * * *"
|
||||
completions: 5
|
||||
parallelism: 6
|
||||
backoffLimit: 3
|
||||
activeDeadlineSeconds: 120
|
||||
ttlSecondsAfterFinished: 150
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.jobTemplate.spec
|
||||
content:
|
||||
completions: 5
|
||||
parallelism: 6
|
||||
backoffLimit: 3
|
||||
activeDeadlineSeconds: 120
|
||||
ttlSecondsAfterFinished: 150
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,926 +0,0 @@
|
||||
suite: jobTemplate test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail with zero value in backoffLimit in jobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
backoffLimit: 0
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Zero value in <backoffLimit> (0) in <job> (job-name) is not allowed. Leave empty to use the default (6)
|
||||
|
||||
- it: should fail with negative value in backoffLimit in jobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
backoffLimit: -1
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <backoffLimit> (-1) in <job> (job-name) must be a positive integer. Leave empty to use the default (6)
|
||||
|
||||
- it: should fail with zero value in ttlSecondsAfterFinished in jobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
ttlSecondsAfterFinished: 0
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Zero value in <ttlSecondsAfterFinished> (0) in <job> (job-name) is not allowed.
|
||||
|
||||
- it: should fail with negative value in ttlSecondsAfterFinished in jobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
ttlSecondsAfterFinished: -1
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <ttlSecondsAfterFinished> (-1) in <job> (job-name) must be a positive integer.
|
||||
|
||||
- it: should fail with zero value in activeDeadlineSeconds in jobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
activeDeadlineSeconds: 0
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Zero value in <activeDeadlineSeconds> (0) in <job> (job-name) is not allowed.
|
||||
|
||||
- it: should fail with negative value in activeDeadlineSeconds in jobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
activeDeadlineSeconds: -1
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <activeDeadlineSeconds> (-1) in <job> (job-name) must be a positive integer.
|
||||
|
||||
- it: should fail with zero value in parallelism in jobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
parallelism: 0
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Zero value in <parallelism> (0) in <job> (job-name) is not allowed.
|
||||
|
||||
- it: should fail with negative value in parallelism in jobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
parallelism: -1
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <parallelism> (-1) in <job> (job-name) must be a positive integer.
|
||||
|
||||
- it: should fail with zero value in completions in jobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
completions: 0
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Zero value in <completions> (0) in <job> (job-name) is not allowed.
|
||||
|
||||
- it: should fail with negative value in completions in jobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
completions: -1
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <completions> (-1) in <job> (job-name) must be a positive integer.
|
||||
|
||||
- it: should fail with invalid completionMode in jobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
completionMode: invalid
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid option (invalid) for <completionMode> in <job> (job-name). Valid options are NonIndexed and Indexed. Leave empty to use the default (NonIndexed)
|
||||
|
||||
- it: should fail without pod in jobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: A pod in <podSpec> is required in <job> (job-name).
|
||||
|
||||
- it: should fail without containers in pod in jobs
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
containers: {}
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: At least one container in <podSpec.containers> is required in <job> (job-name).
|
||||
|
||||
- it: should pass with job values changed
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
dnsPolicy: None
|
||||
hostname: some-hostname
|
||||
priorityClassName: some-priorityClass
|
||||
schedulerName: some-schedulerName
|
||||
serviceAccountName: some-serviceAccountName
|
||||
runtimeClassName: some-runtimeClassName
|
||||
hostNetwork: true
|
||||
enableServiceLinks: true
|
||||
restartPolicy: OnFailure
|
||||
podSecurityContext:
|
||||
fsGroup: 0
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 50
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: default
|
||||
- equal:
|
||||
path: spec.template.spec.dnsPolicy
|
||||
value: ClusterFirst
|
||||
- isNull:
|
||||
path: spec.template.spec.hostname
|
||||
- isNull:
|
||||
path: spec.template.spec.priorityClassName
|
||||
- isNull:
|
||||
path: spec.template.spec.runtimeClassName
|
||||
- isNull:
|
||||
path: spec.template.spec.schedulerName
|
||||
- equal:
|
||||
path: spec.template.spec.hostNetwork
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.enableServiceLinks
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.restartPolicy
|
||||
value: Always
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 568
|
||||
fsGroupChangePolicy: OnRootMismatch
|
||||
supplementalGroups: []
|
||||
|
||||
- it: should pass with default in job
|
||||
documentIndex: &jobDoc 3
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Job
|
||||
- isAPIVersion:
|
||||
of: batch/v1
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
backoffLimit: 6
|
||||
completionMode: NonIndexed
|
||||
|
||||
- it: should pass with default in multiple job (1/2)
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
other-job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Job
|
||||
- isAPIVersion:
|
||||
of: batch/v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-job-name
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
backoffLimit: 6
|
||||
completionMode: NonIndexed
|
||||
|
||||
- it: should pass with default in multiple job (2/2)
|
||||
documentIndex: &otherJobDoc 4
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
other-job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Job
|
||||
- isAPIVersion:
|
||||
of: batch/v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-other-job-name
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
backoffLimit: 6
|
||||
completionMode: NonIndexed
|
||||
|
||||
- it: should pass with backoffLimit set in job
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
backoffLimit: 3
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
backoffLimit: 3
|
||||
|
||||
- it: should pass with completionMode set in job
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
completionMode: Indexed
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
completionMode: Indexed
|
||||
|
||||
- it: should pass with ttlSecondsAfterFinished set in job
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
ttlSecondsAfterFinished: 150
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
ttlSecondsAfterFinished: 150
|
||||
|
||||
- it: should pass with activeDeadlineSeconds set in job
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
activeDeadlineSeconds: 120
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
activeDeadlineSeconds: 120
|
||||
|
||||
- it: should pass with parallelism set in job
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
parallelism: 5
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
parallelism: 5
|
||||
|
||||
- it: should pass with completions set in job
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
completions: 5
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
completions: 5
|
||||
|
||||
- it: should pass with default podSpec
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
enableServiceLinks: false
|
||||
hostNetwork: false
|
||||
restartPolicy: Never
|
||||
securityContext:
|
||||
fsGroup: 568
|
||||
fsGroupChangePolicy: OnRootMismatch
|
||||
supplementalGroups: []
|
||||
|
||||
- it: should pass with inherit set in serviceAccountName
|
||||
documentIndex: &saJobDoc 4
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
serviceAccountName: inherit
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Job
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
serviceAccountName: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with custom serviceAccountName
|
||||
documentIndex: &saJobDoc 4
|
||||
set:
|
||||
saName: custom
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
serviceAccountName: "{{ .Values.saName }}"
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Job
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
serviceAccountName: custom
|
||||
|
||||
- it: should pass with inherit set in schedulerName
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
schedulerName: somename
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
schedulerName: inherit
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
schedulerName: somename
|
||||
|
||||
- it: should pass with custom schedulerName
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
key: somename
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
schedulerName: main-scheduler
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
schedulerName: "{{ .Values.key }}"
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
schedulerName: somename
|
||||
|
||||
- it: should pass with inherit set in terminationgracePeriodSeconds
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
terminationGracePeriodSeconds: 35
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
terminationGracePeriodSeconds: inherit
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
terminationGracePeriodSeconds: 35
|
||||
|
||||
- it: should pass with custom terminationGracePeriodSeconds
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
key: 50
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
terminationGracePeriodSeconds: "{{ .Values.key }}"
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
terminationGracePeriodSeconds: 50
|
||||
|
||||
- it: should pass with inherit set for hostNetwork
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
hostNetwork: true
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
hostNetwork: inherit
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
hostNetwork: true
|
||||
|
||||
- it: should pass with false on hostNetwork and true on main
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
hostNetwork: true
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
hostNetwork: false
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
hostNetwork: false
|
||||
|
||||
- it: should pass with inherit set for enableServiceLinks
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
enableServiceLinks: true
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
enableServiceLinks: inherit
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
enableServiceLinks: true
|
||||
|
||||
- it: should pass with false on enableServiceLinks and true on main
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
enableServiceLinks: true
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
enableServiceLinks: false
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
enableServiceLinks: false
|
||||
|
||||
- it: should pass with changed restartPolicy
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
restartPolicy: Always
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
restartPolicy: Always
|
||||
|
||||
- it: should pass with inherit set in priorityClassName
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
priorityClassName: somename
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
priorityClassName: inherit
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
priorityClassName: somename
|
||||
|
||||
- it: should pass with custom priorityClassName
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
key: somename
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
priorityClassName: main-priorityClass
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
priorityClassName: "{{ .Values.key }}"
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
priorityClassName: somename
|
||||
|
||||
- it: should pass with inherit set in runtimeClassName
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
global:
|
||||
ixChartContext:
|
||||
addNvidiaRuntimeClass: true
|
||||
nvidiaRuntimeClassName: nvidia-runtime
|
||||
scaleGPU:
|
||||
gpu: somegpu
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
runtimeClassName: inherit
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
runtimeClassName: nvidia-runtime
|
||||
|
||||
- it: should pass with custom runtimeClassName
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
runtimeClassName: some-runtime
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
runtimeClassName: some-runtime
|
||||
|
||||
- it: should pass with inherit set in hostname
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
hostname: somename
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
hostname: inherit
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
hostname: somename
|
||||
|
||||
- it: should pass with custom hostname
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
key: somename
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
hostname: main-hostname
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
hostname: "{{ .Values.key }}"
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
hostname: somename
|
||||
|
||||
- it: should pass with inherit set in dnsPolicy
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
dnsPolicy: inherit
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
|
||||
- it: should pass with custom dnsPolicy
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
pod:
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
dnsPolicy: None
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
dnsPolicy: None
|
||||
|
||||
- it: should pass with volumes added
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
persistence:
|
||||
some-volume:
|
||||
enabled: true
|
||||
type: nfs
|
||||
server: some-server
|
||||
path: /some/path
|
||||
mountPath: /some/path
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Job
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: some-volume
|
||||
nfs:
|
||||
server: some-server
|
||||
path: /some/path
|
||||
|
||||
- it: should pass with security Context changed and added gpu
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
global:
|
||||
ixChartContext:
|
||||
addNvidiaRuntimeClass: true
|
||||
nvidiaRuntimeClassName: nvidia-runtime
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
podSecurityContext:
|
||||
fsGroup: 0
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 50
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
scaleGPU:
|
||||
gpu: nvidia
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
runtimeClassName: nvidia-runtime
|
||||
securityContext:
|
||||
fsGroup: 0
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 50
|
||||
- 44
|
||||
|
||||
- it: should pass with security Context set to inherit
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
podSecurityContext:
|
||||
fsGroup: 100
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 100
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
podSecurityContext: inherit
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec
|
||||
content:
|
||||
securityContext:
|
||||
fsGroup: 100
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 100
|
||||
|
||||
- it: should pass with default container
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0]
|
||||
value:
|
||||
name: RELEASE-NAME-common-test-job-main
|
||||
image: repo:tag
|
||||
imagePullPolicy: IfNotPresent
|
||||
tty: false
|
||||
stdin: false
|
||||
env:
|
||||
- name: "TZ"
|
||||
value: "UTC"
|
||||
- name: "UMASK"
|
||||
value: "002"
|
||||
- name: "UMASK_SET"
|
||||
value: "002"
|
||||
- name: "NVIDIA_VISIBLE_DEVICES"
|
||||
value: "void"
|
||||
- name: "S6_READ_ONLY_ROOT"
|
||||
value: "1"
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 568
|
||||
runAsGroup: 568
|
||||
readOnlyRootFilesystem: true
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
capabilities:
|
||||
add: []
|
||||
drop:
|
||||
- "ALL"
|
||||
resources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 50Mi
|
||||
limits:
|
||||
cpu: 4000m
|
||||
memory: 8Gi
|
||||
@@ -1,127 +0,0 @@
|
||||
suite: job test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should pass with disabled job
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: false
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
|
||||
- it: should pass with defined job
|
||||
documentIndex: &jobDoc 3
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Job
|
||||
- isAPIVersion:
|
||||
of: batch/v1
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-job-name
|
||||
|
||||
- it: should pass with nameOverride defined in job
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
nameOverride: other-job-name
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-other-job-name
|
||||
|
||||
- it: should pass with global labels and labels from tpl defined in job
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
l1: val1
|
||||
l2: val2
|
||||
global:
|
||||
labels:
|
||||
label1: val3
|
||||
label2: val4
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
labels:
|
||||
l1: "{{ .Values.l1 }}"
|
||||
l2: "{{ .Values.l2 }}"
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
release: RELEASE-NAME
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
l1: val1
|
||||
l2: val2
|
||||
label1: val3
|
||||
label2: val4
|
||||
|
||||
- it: should pass with annotations from tpl defined in job
|
||||
documentIndex: *jobDoc
|
||||
set:
|
||||
a1: val1
|
||||
a2: val2
|
||||
global:
|
||||
annotations:
|
||||
annotation1: val3
|
||||
annotation2: val4
|
||||
jobs:
|
||||
job-name:
|
||||
enabled: true
|
||||
annotations:
|
||||
a1: "{{ .Values.a1 }}"
|
||||
a2: "{{ .Values.a2 }}"
|
||||
podSpec:
|
||||
containers:
|
||||
main:
|
||||
imageSelector: image
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
a1: val1
|
||||
a2: val2
|
||||
annotation1: val3
|
||||
annotation2: val4
|
||||
@@ -1,70 +0,0 @@
|
||||
suite: deviceList test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: spec.template.spec.volume
|
||||
|
||||
- it: should pass with deviceList defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
deviceList:
|
||||
- enabled: true
|
||||
type: hostPath
|
||||
mountPath: /dev/usb
|
||||
hostPath: /dev/usb
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
name: device-0
|
||||
mountPath: /dev/usb
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: device-0
|
||||
hostPath:
|
||||
path: /dev/usb
|
||||
|
||||
- it: should pass with deviceList defined as readOnly
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
deviceList:
|
||||
- enabled: true
|
||||
type: hostPath
|
||||
mountPath: /dev/usb
|
||||
hostPath: /dev/usb
|
||||
readOnly: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
name: device-0
|
||||
mountPath: /dev/usb
|
||||
readOnly: true
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: device-0
|
||||
hostPath:
|
||||
path: /dev/usb
|
||||
|
||||
- it: should pass with deviceList defined, validateHostPath true and a malicious not allowed path
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
deviceList:
|
||||
- enabled: true
|
||||
type: hostPath
|
||||
mountPath: /dev/usb
|
||||
hostPath: /mnt
|
||||
validateHostPath: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid hostPath (/mnt). Allowed hostPaths are valid paths under a given pool. e.g. /mnt/POOL/DATASET, /mnt/POOL/DATASET/DIRECTORY
|
||||
@@ -1,106 +0,0 @@
|
||||
suite: persistenceList test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- isNull:
|
||||
path: spec.template.spec.volume
|
||||
|
||||
- it: should pass with persistenceList defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistenceList:
|
||||
- enabled: true
|
||||
type: pvc
|
||||
mountPath: /some-path
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
name: persist-list-0
|
||||
mountPath: /some-path
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: persist-list-0
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME-common-test-persist-list-0
|
||||
|
||||
- it: should pass with persistenceList defined
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistenceList:
|
||||
- enabled: true
|
||||
type: nfs
|
||||
server: 10.10.10.100
|
||||
path: /nfs/path
|
||||
mountPath: /some-path
|
||||
- enabled: true
|
||||
type: hostPath
|
||||
mountPath: /some-path
|
||||
hostPath: /mnt/pool/dataset/dir
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
name: persist-list-0
|
||||
mountPath: /some-path
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
name: persist-list-1
|
||||
mountPath: /some-path
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: persist-list-0
|
||||
nfs:
|
||||
server: 10.10.10.100
|
||||
path: /nfs/path
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: persist-list-1
|
||||
hostPath:
|
||||
path: /mnt/pool/dataset/dir
|
||||
|
||||
- it: should pass with persistenceList defined as readOnly
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistenceList:
|
||||
- enabled: true
|
||||
type: pvc
|
||||
mountPath: /some-path
|
||||
readOnly: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
name: persist-list-0
|
||||
mountPath: /some-path
|
||||
readOnly: true
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: persist-list-0
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME-common-test-persist-list-0
|
||||
|
||||
- it: should pass with persistenceList defined, validateHostPath true and a malicious not allowed path
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
persistenceList:
|
||||
- enabled: true
|
||||
type: hostPath
|
||||
mountPath: /some-path
|
||||
hostPath: /mnt
|
||||
validateHostPath: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid hostPath (/mnt). Allowed hostPaths are valid paths under a given pool. e.g. /mnt/POOL/DATASET, /mnt/POOL/DATASET/DIRECTORY
|
||||
@@ -1,180 +0,0 @@
|
||||
suite: serviceList test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should pass with serviceList defined (container)
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
serviceList:
|
||||
- enabled: true
|
||||
type: ClusterIP
|
||||
portsList:
|
||||
- enabled: true
|
||||
primary: true
|
||||
protocol: HTTP
|
||||
targetPort: 1234
|
||||
port: 3425
|
||||
- enabled: true
|
||||
protocol: HTTP
|
||||
targetPort: 12346
|
||||
port: 3427
|
||||
- enabled: true
|
||||
type: NodePort
|
||||
portsList:
|
||||
- enabled: true
|
||||
protocol: HTTP
|
||||
targetPort: 12345
|
||||
nodePort: 30000
|
||||
port: 3426
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0]
|
||||
content:
|
||||
ports:
|
||||
- containerPort: 65535
|
||||
name: main
|
||||
protocol: TCP
|
||||
- name: port-list-0-0
|
||||
containerPort: 1234
|
||||
protocol: TCP
|
||||
- name: port-list-0-1
|
||||
containerPort: 12346
|
||||
protocol: TCP
|
||||
- name: port-list-1-0
|
||||
containerPort: 12345
|
||||
protocol: TCP
|
||||
|
||||
- it: should pass with serviceList defined (service 1/2)
|
||||
documentIndex: &serviceDoc 3
|
||||
set:
|
||||
serviceList:
|
||||
- enabled: true
|
||||
type: ClusterIP
|
||||
portsList:
|
||||
- enabled: true
|
||||
primary: true
|
||||
protocol: HTTP
|
||||
targetPort: 1234
|
||||
port: 3425
|
||||
- enabled: true
|
||||
protocol: HTTP
|
||||
targetPort: 12346
|
||||
port: 3427
|
||||
- enabled: true
|
||||
type: NodePort
|
||||
portsList:
|
||||
- enabled: true
|
||||
protocol: HTTP
|
||||
targetPort: 12345
|
||||
nodePort: 30000
|
||||
port: 3426
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
type: NodePort
|
||||
ports:
|
||||
- name: port-list-1-0
|
||||
port: 3426
|
||||
protocol: TCP
|
||||
targetPort: 12345
|
||||
nodePort: 30000
|
||||
|
||||
- it: should pass with serviceList defined (service 2/2)
|
||||
documentIndex: &otherServiceDoc 2
|
||||
set:
|
||||
serviceList:
|
||||
- enabled: true
|
||||
type: ClusterIP
|
||||
portsList:
|
||||
- enabled: true
|
||||
primary: true
|
||||
protocol: HTTP
|
||||
targetPort: 1234
|
||||
port: 3425
|
||||
- enabled: true
|
||||
protocol: HTTP
|
||||
targetPort: 12346
|
||||
port: 3427
|
||||
- enabled: true
|
||||
type: NodePort
|
||||
portsList:
|
||||
- enabled: true
|
||||
protocol: HTTP
|
||||
targetPort: 12345
|
||||
nodePort: 30000
|
||||
port: 3426
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec
|
||||
content:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: port-list-0-0
|
||||
port: 3425
|
||||
protocol: TCP
|
||||
targetPort: 1234
|
||||
- name: port-list-0-1
|
||||
port: 3427
|
||||
protocol: TCP
|
||||
targetPort: 12346
|
||||
|
||||
- it: should pass with serviceList defined (portal)
|
||||
documentIndex: &portalDoc 4
|
||||
set:
|
||||
serviceList:
|
||||
- enabled: true
|
||||
type: ClusterIP
|
||||
portsList:
|
||||
- enabled: true
|
||||
primary: true
|
||||
protocol: HTTP
|
||||
targetPort: 1234
|
||||
port: 3425
|
||||
- enabled: true
|
||||
protocol: HTTP
|
||||
targetPort: 12346
|
||||
port: 3427
|
||||
- enabled: true
|
||||
type: NodePort
|
||||
portsList:
|
||||
- enabled: true
|
||||
protocol: HTTP
|
||||
targetPort: 12345
|
||||
nodePort: 30000
|
||||
port: 3426
|
||||
asserts:
|
||||
- equal:
|
||||
path: kind
|
||||
value: ConfigMap
|
||||
- equal:
|
||||
path: data
|
||||
value:
|
||||
host-main-main: $node_ip
|
||||
host-svc-list-0-port-list-0-0: $node_ip
|
||||
host-svc-list-0-port-list-0-1: $node_ip
|
||||
host-svc-list-1-port-list-1-0: $node_ip
|
||||
path-main-main: /
|
||||
path-svc-list-0-port-list-0-0: /
|
||||
path-svc-list-0-port-list-0-1: /
|
||||
path-svc-list-1-port-list-1-0: /
|
||||
port-main-main: "443"
|
||||
port-svc-list-0-port-list-0-0: "443"
|
||||
port-svc-list-0-port-list-0-1: "443"
|
||||
port-svc-list-1-port-list-1-0: "30000"
|
||||
protocol-main-main: http
|
||||
protocol-svc-list-0-port-list-0-0: http
|
||||
protocol-svc-list-0-port-list-0-1: http
|
||||
protocol-svc-list-1-port-list-1-0: http
|
||||
url-main-main: http://$node_ip:443/
|
||||
url-svc-list-0-port-list-0-0: http://$node_ip:443/
|
||||
url-svc-list-0-port-list-0-1: http://$node_ip:443/
|
||||
url-svc-list-1-port-list-1-0: http://$node_ip:30000/
|
||||
@@ -1,279 +0,0 @@
|
||||
suite: portal host test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail with portal override with empty host
|
||||
set:
|
||||
portal:
|
||||
main:
|
||||
main:
|
||||
host:
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
port: 10000
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: You have defined empty <host> in <portal>. Define a host or remove the key.
|
||||
|
||||
- it: should pass with defaults on single service/port
|
||||
documentIndex: &portalDoc 2
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
host-main-main: $node_ip
|
||||
|
||||
- it: should pass with LoadBalancer and IP set on single service/port
|
||||
documentIndex: &portalDoc 2
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
type: LoadBalancer
|
||||
loadBalancerIP: 10.10.10.100
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
host-main-main: "10.10.10.100"
|
||||
|
||||
- it: should pass with host override on single service/port
|
||||
documentIndex: *portalDoc
|
||||
set:
|
||||
portal:
|
||||
main:
|
||||
main:
|
||||
host: 10.10.10.100
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
port: 10000
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
host-main-main: "10.10.10.100"
|
||||
|
||||
- it: should pass with defaults on multiple service/port
|
||||
documentIndex: &dualServicePortalDoc 3
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
main2:
|
||||
enabled: true
|
||||
port: 10001
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
other:
|
||||
enabled: true
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10002
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
other2:
|
||||
enabled: true
|
||||
port: 10003
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
host-main-main: $node_ip
|
||||
host-main-main2: $node_ip
|
||||
host-other-other: $node_ip
|
||||
host-other-other2: $node_ip
|
||||
|
||||
- it: should pass with host override on multiple service/port
|
||||
documentIndex: *dualServicePortalDoc
|
||||
set:
|
||||
portal:
|
||||
main:
|
||||
main:
|
||||
host: 10.10.10.100
|
||||
main2:
|
||||
host: 10.10.10.101
|
||||
other:
|
||||
other:
|
||||
host: 10.10.10.102
|
||||
other2:
|
||||
host: 10.10.10.103
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
main2:
|
||||
enabled: true
|
||||
port: 10001
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
other:
|
||||
enabled: true
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10002
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
other2:
|
||||
enabled: true
|
||||
port: 10003
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
host-main-main: "10.10.10.100"
|
||||
host-main-main2: "10.10.10.101"
|
||||
host-other-other: "10.10.10.102"
|
||||
host-other-other2: "10.10.10.103"
|
||||
|
||||
- it: should pass with override on multiple service/port from tpl
|
||||
documentIndex: *dualServicePortalDoc
|
||||
set:
|
||||
host1: 10.10.10.100
|
||||
host2: 10.10.10.101
|
||||
host3: 10.10.10.102
|
||||
host4: 10.10.10.103
|
||||
portal:
|
||||
main:
|
||||
main:
|
||||
host: "{{ .Values.host1 }}"
|
||||
main2:
|
||||
host: "{{ .Values.host2 }}"
|
||||
other:
|
||||
other:
|
||||
host: "{{ .Values.host3 }}"
|
||||
other2:
|
||||
host: "{{ .Values.host4 }}"
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
main2:
|
||||
enabled: true
|
||||
port: 10001
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
other:
|
||||
enabled: true
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10002
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
other2:
|
||||
enabled: true
|
||||
port: 10003
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
host-main-main: "10.10.10.100"
|
||||
host-main-main2: "10.10.10.101"
|
||||
host-other-other: "10.10.10.102"
|
||||
host-other-other2: "10.10.10.103"
|
||||
@@ -1,270 +0,0 @@
|
||||
suite: portal path test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail with portal override with empty path
|
||||
set:
|
||||
portal:
|
||||
main:
|
||||
main:
|
||||
path:
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
port: 10000
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: You have defined empty <path> in <portal>. Define a path or remove the key.
|
||||
|
||||
- it: should fail with portal override with path not starting with /
|
||||
set:
|
||||
portal:
|
||||
main:
|
||||
main:
|
||||
path: a/relative/path
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
port: 10000
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Portal path (a/relative/path) must start with a forward slash -> / <-
|
||||
|
||||
- it: should pass with defaults on single service/port
|
||||
documentIndex: &portalDoc 2
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
path-main-main: /
|
||||
|
||||
- it: should pass with path override on single service/port
|
||||
documentIndex: *portalDoc
|
||||
set:
|
||||
portal:
|
||||
main:
|
||||
main:
|
||||
path: /some_path
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
port: 10000
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
path-main-main: /some_path
|
||||
|
||||
- it: should pass with defaults on multiple service/port
|
||||
documentIndex: &dualServicePortalDoc 3
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
main2:
|
||||
enabled: true
|
||||
port: 10001
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
other:
|
||||
enabled: true
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10002
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
other2:
|
||||
enabled: true
|
||||
port: 10003
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
path-main-main: /
|
||||
path-main-main2: /
|
||||
path-other-other: /
|
||||
path-other-other2: /
|
||||
|
||||
- it: should pass with path override on multiple service/port
|
||||
documentIndex: *dualServicePortalDoc
|
||||
set:
|
||||
portal:
|
||||
main:
|
||||
main:
|
||||
path: /some_path1
|
||||
main2:
|
||||
path: /some_path2
|
||||
other:
|
||||
other:
|
||||
path: /some_path3
|
||||
other2:
|
||||
path: /some_path4
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
main2:
|
||||
enabled: true
|
||||
port: 10001
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
other:
|
||||
enabled: true
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10002
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
other2:
|
||||
enabled: true
|
||||
port: 10003
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
path-main-main: /some_path1
|
||||
path-main-main2: /some_path2
|
||||
path-other-other: /some_path3
|
||||
path-other-other2: /some_path4
|
||||
|
||||
- it: should pass with path override on multiple service/port from tpl
|
||||
documentIndex: *dualServicePortalDoc
|
||||
set:
|
||||
path1: /some_path1
|
||||
path2: /some_path2
|
||||
path3: /some_path3
|
||||
path4: /some_path4
|
||||
portal:
|
||||
main:
|
||||
main:
|
||||
path: "{{ .Values.path1 }}"
|
||||
main2:
|
||||
path: "{{ .Values.path2 }}"
|
||||
other:
|
||||
other:
|
||||
path: "{{ .Values.path3 }}"
|
||||
other2:
|
||||
path: "{{ .Values.path4 }}"
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
main2:
|
||||
enabled: true
|
||||
port: 10001
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
other:
|
||||
enabled: true
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10002
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
other2:
|
||||
enabled: true
|
||||
port: 10003
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
path-main-main: /some_path1
|
||||
path-main-main2: /some_path2
|
||||
path-other-other: /some_path3
|
||||
path-other-other2: /some_path4
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,469 +0,0 @@
|
||||
suite: portal protocol test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail with portal override with invalid protocol
|
||||
set:
|
||||
portal:
|
||||
main:
|
||||
main:
|
||||
protocol: tcp
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
port: 10000
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid protocol (tcp). Only HTTP/HTTPS protocols are allowed for <portal>
|
||||
|
||||
- it: should pass with http protocol on single service/port
|
||||
documentIndex: &portalDoc 2
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
protocol-main-main: http
|
||||
|
||||
- it: should pass with https protocol on single service/port
|
||||
documentIndex: *portalDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
protocol-main-main: https
|
||||
|
||||
- it: should pass with no protocol on single service/port
|
||||
documentIndex: *portalDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
port: 10000
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
protocol-main-main: http
|
||||
|
||||
- it: should pass with http protocol on multiple service/port
|
||||
documentIndex: &dualServicePortalDoc 3
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
main2:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
other:
|
||||
enabled: true
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
other2:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTP
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
protocol-main-main: http
|
||||
protocol-main-main2: http
|
||||
protocol-other-other: http
|
||||
protocol-other-other2: http
|
||||
|
||||
- it: should pass with https protocol on multiple service/port
|
||||
documentIndex: &dualServicePortalDoc 3
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
main2:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
other:
|
||||
enabled: true
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
other2:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
protocol-main-main: https
|
||||
protocol-main-main2: https
|
||||
protocol-other-other: https
|
||||
protocol-other-other2: https
|
||||
|
||||
- it: should pass with no protocol on multiple service/port
|
||||
documentIndex: &dualServicePortalDoc 3
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
targetPort: 80
|
||||
main2:
|
||||
enabled: true
|
||||
port: 10000
|
||||
targetPort: 80
|
||||
other:
|
||||
enabled: true
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
targetPort: 80
|
||||
other2:
|
||||
enabled: true
|
||||
port: 10000
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
protocol-main-main: http
|
||||
protocol-main-main2: http
|
||||
protocol-other-other: http
|
||||
protocol-other-other2: http
|
||||
|
||||
- it: should pass with https protocol on multiple service/port and override on single
|
||||
documentIndex: &dualServicePortalDoc 3
|
||||
set:
|
||||
portal:
|
||||
other:
|
||||
other:
|
||||
protocol: http
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
main2:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
other:
|
||||
enabled: true
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
other2:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
protocol-main-main: https
|
||||
protocol-main-main2: https
|
||||
protocol-other-other: http
|
||||
protocol-other-other2: https
|
||||
|
||||
- it: should pass with https protocol on multiple service/port and override on single (caps)
|
||||
documentIndex: *dualServicePortalDoc
|
||||
set:
|
||||
portal:
|
||||
other:
|
||||
other:
|
||||
protocol: HTTP
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
main2:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
other:
|
||||
enabled: true
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
other2:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
protocol-main-main: https
|
||||
protocol-main-main2: https
|
||||
protocol-other-other: http
|
||||
protocol-other-other2: https
|
||||
|
||||
- it: should pass with https protocol on multiple service/port and override on multiple
|
||||
documentIndex: *dualServicePortalDoc
|
||||
set:
|
||||
portal:
|
||||
main:
|
||||
main:
|
||||
protocol: http
|
||||
main2:
|
||||
protocol: http
|
||||
other:
|
||||
other:
|
||||
protocol: http
|
||||
other2:
|
||||
protocol: http
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
main2:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
other:
|
||||
enabled: true
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
other2:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
protocol-main-main: http
|
||||
protocol-main-main2: http
|
||||
protocol-other-other: http
|
||||
protocol-other-other2: http
|
||||
|
||||
- it: should pass with https protocol on multiple service/port and override on multiple from tpl
|
||||
documentIndex: *dualServicePortalDoc
|
||||
set:
|
||||
protocol1: http
|
||||
protocol2: http
|
||||
protocol3: http
|
||||
protocol4: http
|
||||
portal:
|
||||
main:
|
||||
main:
|
||||
protocol: "{{ .Values.protocol1 }}"
|
||||
main2:
|
||||
protocol: "{{ .Values.protocol2 }}"
|
||||
other:
|
||||
other:
|
||||
protocol: "{{ .Values.protocol3 }}"
|
||||
other2:
|
||||
protocol: "{{ .Values.protocol4 }}"
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
main2:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
other:
|
||||
enabled: true
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
other2:
|
||||
enabled: true
|
||||
port: 10000
|
||||
protocol: HTTPS
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: portal
|
||||
- isSubset:
|
||||
path: data
|
||||
content:
|
||||
protocol-main-main: http
|
||||
protocol-main-main2: http
|
||||
protocol-other-other: http
|
||||
protocol-other-other2: http
|
||||
@@ -1,120 +0,0 @@
|
||||
suite: portal port test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &portalDoc 2
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
|
||||
- it: should pass with portal disabled
|
||||
set:
|
||||
portal:
|
||||
enabled: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
|
||||
- it: should pass with default labels
|
||||
documentIndex: *portalDoc
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with global labels
|
||||
documentIndex: *portalDoc
|
||||
set:
|
||||
global:
|
||||
labels:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
|
||||
- it: should pass with global labels from tpl
|
||||
documentIndex: *portalDoc
|
||||
set:
|
||||
k1: some_value
|
||||
k2: some_value1
|
||||
global:
|
||||
labels:
|
||||
some_key: "{{ .Values.k1 }}"
|
||||
some_key1: "{{ .Values.k2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
|
||||
- it: should pass with default annotations
|
||||
documentIndex: *portalDoc
|
||||
asserts:
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
|
||||
- it: should pass with global annotations
|
||||
documentIndex: *portalDoc
|
||||
set:
|
||||
global:
|
||||
annotations:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
|
||||
- it: should pass with global annotations from tpl
|
||||
documentIndex: *portalDoc
|
||||
set:
|
||||
k1: some_value
|
||||
k2: some_value1
|
||||
global:
|
||||
annotations:
|
||||
some_key: "{{ .Values.k1 }}"
|
||||
some_key1: "{{ .Values.k2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
@@ -1,693 +0,0 @@
|
||||
suite: pvc test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail with SCALE-ZFS storageClass but not scaleZFSStorageClass in global
|
||||
set:
|
||||
globalDefaults:
|
||||
scaleZFSStorageClass: ""
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
type: pvc
|
||||
storageClass: SCALE-ZFS
|
||||
mountPath: /somepath
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: A storageClass must be defined in globalDefaults.scaleZFSStorageClass
|
||||
|
||||
- it: should fail with invalid accessMode
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
type: pvc
|
||||
accessMode: invalid_mode
|
||||
mountPath: /somepath
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid <accessMode> option (invalid_mode). Valid options are ReadWriteOnce, ReadOnlyMany, ReadWriteMany and ReadWriteOncePod
|
||||
|
||||
- it: should pass with correct name
|
||||
documentIndex: &pvcDoc 2
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
type: pvc
|
||||
mountPath: /somepath
|
||||
asserts:
|
||||
- isKind:
|
||||
of: PersistentVolumeClaim
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-vol1
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
- isNull:
|
||||
path: spec.volumeName
|
||||
|
||||
- it: should pass with force name defined
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
type: pvc
|
||||
mountPath: /somepath
|
||||
forceName: forced_name
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: forced_name
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
- isNull:
|
||||
path: spec.volumeName
|
||||
|
||||
- it: should pass with force name defined from tpl
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
some_name: forced_name
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
type: pvc
|
||||
mountPath: /somepath
|
||||
forceName: "{{ .Values.some_name }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: forced_name
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
- isNull:
|
||||
path: spec.volumeName
|
||||
|
||||
- it: should pass with nameOverride defined
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
type: pvc
|
||||
mountPath: /somepath
|
||||
nameOverride: some_name
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some_name
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
- isNull:
|
||||
path: spec.volumeName
|
||||
|
||||
- it: should pass without type explicitly set to pvc
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-vol1
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
- isNull:
|
||||
path: spec.volumeName
|
||||
|
||||
- it: should pass without accessMode explicitly set to ReadWriteOnce
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
- isNull:
|
||||
path: spec.volumeName
|
||||
|
||||
- it: should pass with accessMode changed
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
accessMode: ReadOnlyMany
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadOnlyMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
- isNull:
|
||||
path: spec.volumeName
|
||||
|
||||
- it: should pass with accessMode changed from tpl
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
mode: ReadOnlyMany
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
accessMode: "{{ .Values.mode }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadOnlyMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
- isNull:
|
||||
path: spec.volumeName
|
||||
|
||||
- it: should pass without size explicitly set to 1Gi
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
- isNull:
|
||||
path: spec.volumeName
|
||||
|
||||
- it: should pass with size changed
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
size: 2Gi
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 2Gi
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
- isNull:
|
||||
path: spec.volumeName
|
||||
|
||||
- it: should pass with size changed from tpl
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
size: 2Gi
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
size: "{{ .Values.size }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 2Gi
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
- isNull:
|
||||
path: spec.volumeName
|
||||
|
||||
- it: should pass with storageClass set to SCALE-ZFS
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
globalDefaults:
|
||||
scaleZFSStorageClass: something
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
storageClass: SCALE-ZFS
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
storageClassName: something
|
||||
|
||||
- it: should pass with storageClass set to SCALE-ZFS from tpl
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
key: something
|
||||
globalDefaults:
|
||||
scaleZFSStorageClass: "{{ .Values.key }}"
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
storageClass: SCALE-ZFS
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
storageClassName: something
|
||||
|
||||
- it: should pass with storageClass set to "-"
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
storageClass: "-"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
storageClassName: ""
|
||||
- isNotNull:
|
||||
path: spec.storageClassName
|
||||
|
||||
- it: should pass with storageClass set to something
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
storageClass: something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
storageClassName: something
|
||||
|
||||
- it: should pass with storageClass set to something from tpl
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
scName: something
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
storageClass: "{{ .Values.scName }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
storageClassName: something
|
||||
|
||||
- it: should pass with storageClass defined globally
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
globalDefaults:
|
||||
storageClass: something
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
storageClassName: something
|
||||
|
||||
- it: should pass with volumeName set to something
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
volumeName: something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
volumeName: something
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
|
||||
- it: should pass with volumeName set to something from tpl
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
vName: something
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
volumeName: "{{ .Values.vName }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
volumeName: something
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
|
||||
- it: should pass with custom spec is applied
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
spec:
|
||||
some:
|
||||
value: custom
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
some:
|
||||
value: custom
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
- isNull:
|
||||
path: spec.volumeName
|
||||
|
||||
- it: should pass with custom spec is applied with tpl
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
key: custom
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
spec:
|
||||
some:
|
||||
value: "{{ .Values.key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
some:
|
||||
value: custom
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
- isNull:
|
||||
path: spec.volumeName
|
||||
|
||||
- it: should pass with multiple persistence enabled
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
vol2:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-vol1
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
- isNull:
|
||||
path: spec.volumeName
|
||||
|
||||
- it: should pass with multiple persistence enabled (other pvcDoc)
|
||||
documentIndex: &otherPvcDoc 3
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
vol2:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-vol2
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
- isNull:
|
||||
path: spec.storageClassName
|
||||
- isNull:
|
||||
path: spec.volumeName
|
||||
|
||||
- it: should pass with labels
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
labels:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
|
||||
- it: should pass with labels and global labels
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
global:
|
||||
labels:
|
||||
some_key2: value2
|
||||
some_key3: value3
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
labels:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
some_key2: value2
|
||||
some_key3: value3
|
||||
|
||||
- it: should pass with annotations
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
annotations:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
|
||||
- it: should pass with annotations and global annotations
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
global:
|
||||
annotations:
|
||||
some_key2: value2
|
||||
some_key3: value3
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
annotations:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
some_key2: value2
|
||||
some_key3: value3
|
||||
|
||||
- it: should pass with annotations and global retain true
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
globalDefaults:
|
||||
PVCRetain: true
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
annotations:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
"helm.sh/resource-policy": keep
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
|
||||
- it: should pass with annotations and global retain true and pvc object to false
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
globalDefaults:
|
||||
PVCRetain: true
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
retain: false
|
||||
annotations:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
|
||||
- it: should pass with annotations and global retain false and pvc object to true
|
||||
documentIndex: *pvcDoc
|
||||
set:
|
||||
globalDefaults:
|
||||
PVCRetain: false
|
||||
persistence:
|
||||
vol1:
|
||||
enabled: true
|
||||
mountPath: /somepath
|
||||
retain: true
|
||||
annotations:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
"helm.sh/resource-policy": keep
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,679 +0,0 @@
|
||||
suite: secret test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail without a dict in secret
|
||||
set:
|
||||
secret:
|
||||
enabled: true
|
||||
content:
|
||||
key: value
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <secret> key must have at least one dict. Found (bool)
|
||||
|
||||
- it: should fail with uppercase in name in secret
|
||||
set:
|
||||
secret:
|
||||
someName:
|
||||
enabled: true
|
||||
content:
|
||||
key: value
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Secret has invalid name (someName). Name must be lowercase.
|
||||
|
||||
- it: should fail with underscore in name in secret
|
||||
set:
|
||||
secret:
|
||||
some_name:
|
||||
enabled: true
|
||||
content:
|
||||
key: value
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Secret has invalid name (some_name). Name cannot contain underscores (_).
|
||||
|
||||
- it: should fail with empty content in secret
|
||||
set:
|
||||
secret:
|
||||
somename:
|
||||
enabled: true
|
||||
content:
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Content of Secret (somename) are empty. Please disable or add content.
|
||||
|
||||
- it: should fail with string in content in secret
|
||||
set:
|
||||
secret:
|
||||
somename:
|
||||
enabled: true
|
||||
content: something
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Content of Secret (somename) are string. Must be in key/value format. Value can be scalar too.
|
||||
|
||||
- it: should pass with 1 secret created with parseAsEnv set
|
||||
documentIndex: &secretDoc 0
|
||||
set:
|
||||
secret:
|
||||
some-name:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
key1: 123
|
||||
key2: value2
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- isKind:
|
||||
of: Secret
|
||||
- equal:
|
||||
path: type
|
||||
value: Opaque
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-name
|
||||
- equal:
|
||||
path: stringData
|
||||
value:
|
||||
key1: "123"
|
||||
key2: value2
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with empty key in content in secret
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
secret:
|
||||
somename:
|
||||
enabled: true
|
||||
content:
|
||||
key: ""
|
||||
asserts:
|
||||
- equal:
|
||||
path: stringData
|
||||
value:
|
||||
key: ""
|
||||
|
||||
- it: should pass with 1 secret created with parseAsEnv and values set from tpl
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
k1: 123
|
||||
k2: value2
|
||||
secret:
|
||||
some-name:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
key1: "{{ .Values.k1 }}"
|
||||
key2: "{{ .Values.k2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: stringData
|
||||
value:
|
||||
key1: "123"
|
||||
key2: value2
|
||||
|
||||
- it: should pass with 1 secret created with nameOverride set
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
k1: true
|
||||
k2: value2
|
||||
secret:
|
||||
some-name:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
nameOverride: some-new-name
|
||||
content:
|
||||
key1: "{{ .Values.k1 }}"
|
||||
key2: "{{ .Values.k2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: stringData
|
||||
value:
|
||||
key1: "true"
|
||||
key2: value2
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-new-name
|
||||
|
||||
- it: should pass with multiple secret created with parseAsEnv set (1/2) and values from tpl
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
k1: value1
|
||||
k2: value2
|
||||
k3: value3
|
||||
k4: value4
|
||||
secret:
|
||||
some-name:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
key1: "{{ .Values.k1 }}"
|
||||
key2: "{{ .Values.k2 }}"
|
||||
some-other-name:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
key3: "{{ .Values.k3 }}"
|
||||
key4: "{{ .Values.k4 }}"
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: type
|
||||
value: Opaque
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-name
|
||||
- equal:
|
||||
path: stringData
|
||||
value:
|
||||
key1: value1
|
||||
key2: value2
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with multiple secret created with parseAsEnv set (2/2) and values from tpl
|
||||
documentIndex: &otherSecretDoc 1
|
||||
set:
|
||||
secret:
|
||||
some-name:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
some-other-name:
|
||||
enabled: true
|
||||
parseAsEnv: true
|
||||
content:
|
||||
key3: value3
|
||||
key4: value4
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: Secret
|
||||
- equal:
|
||||
path: type
|
||||
value: Opaque
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-other-name
|
||||
- equal:
|
||||
path: stringData
|
||||
value:
|
||||
key3: value3
|
||||
key4: value4
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with multiple secret created with scalar in contents and tpl (1/2)
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
k1: value1
|
||||
k2: 80
|
||||
k3: pair
|
||||
k4: value2
|
||||
k5: 81
|
||||
k6: pair2
|
||||
secret:
|
||||
some-name:
|
||||
enabled: true
|
||||
content:
|
||||
nginx.conf1: |
|
||||
alias {{ .Values.k1 }}
|
||||
listen {{ .Values.k2 }}
|
||||
|
||||
function {
|
||||
# some json
|
||||
"key": {
|
||||
"key2": "value",
|
||||
"key3": "value2"
|
||||
}
|
||||
}
|
||||
key: "{{ .Values.k3 }}"
|
||||
some-other-name:
|
||||
enabled: true
|
||||
content:
|
||||
key: "{{ .Values.k6 }}"
|
||||
nginx.conf2: |
|
||||
alias {{ .Values.k4 }}
|
||||
listen {{ .Values.k5 }}
|
||||
|
||||
function {
|
||||
# some json
|
||||
"key": {
|
||||
"key2": "value",
|
||||
"key3": "value2"
|
||||
}
|
||||
}
|
||||
asserts:
|
||||
- equal:
|
||||
path: stringData
|
||||
value:
|
||||
key: pair
|
||||
nginx.conf1: |
|
||||
alias value1
|
||||
listen 80
|
||||
|
||||
function {
|
||||
# some json
|
||||
"key": {
|
||||
"key2": "value",
|
||||
"key3": "value2"
|
||||
}
|
||||
}
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-name
|
||||
|
||||
- it: should pass with multiple secret created with scalar in contents and tpl (2/2)
|
||||
documentIndex: *otherSecretDoc
|
||||
set:
|
||||
k1: value1
|
||||
k2: 80
|
||||
k3: pair
|
||||
k4: value2
|
||||
k5: 81
|
||||
k6: pair2
|
||||
secret:
|
||||
some-name:
|
||||
enabled: true
|
||||
content:
|
||||
key: "{{ .Values.k3 }}"
|
||||
nginx.conf1: |
|
||||
alias {{ .Values.k1 }}
|
||||
listen {{ .Values.k2 }}
|
||||
|
||||
function {
|
||||
# some json
|
||||
"key": {
|
||||
"key2": "value",
|
||||
"key3": "value2"
|
||||
}
|
||||
}
|
||||
some-other-name:
|
||||
enabled: true
|
||||
content:
|
||||
key: "{{ .Values.k6 }}"
|
||||
nginx.conf2: |
|
||||
alias {{ .Values.k4 }}
|
||||
listen {{ .Values.k5 }}
|
||||
|
||||
function {
|
||||
# some json
|
||||
"key": {
|
||||
"key2": "value",
|
||||
"key3": "value2"
|
||||
}
|
||||
}
|
||||
asserts:
|
||||
- equal:
|
||||
path: stringData
|
||||
value:
|
||||
key: pair2
|
||||
nginx.conf2: |
|
||||
alias value2
|
||||
listen 81
|
||||
|
||||
function {
|
||||
# some json
|
||||
"key": {
|
||||
"key2": "value",
|
||||
"key3": "value2"
|
||||
}
|
||||
}
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-other-name
|
||||
|
||||
- it: should pass with multiple secret created and labels and global labels added from tpl (1/2)
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
l1: lab1
|
||||
l2: lab2
|
||||
l5: lab5
|
||||
l6: lab6
|
||||
global:
|
||||
labels:
|
||||
gl1: glab1
|
||||
gl2: glab2
|
||||
secret:
|
||||
some-name:
|
||||
enabled: true
|
||||
labels:
|
||||
label1: "{{ .Values.l1 }}"
|
||||
label2: "{{ .Values.l2 }}"
|
||||
label3: lab3
|
||||
label4: lab4
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
some-other-name:
|
||||
enabled: true
|
||||
labels:
|
||||
label5: "{{ .Values.l5 }}"
|
||||
label6: "{{ .Values.l6 }}"
|
||||
label7: lab7
|
||||
label8: lab8
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: Secret
|
||||
- equal:
|
||||
path: type
|
||||
value: Opaque
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-name
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
label1: lab1
|
||||
label2: lab2
|
||||
label3: lab3
|
||||
label4: lab4
|
||||
gl1: glab1
|
||||
gl2: glab2
|
||||
|
||||
- it: should pass with multiple secret created and labels and global labels added from tpl (2/2)
|
||||
documentIndex: *otherSecretDoc
|
||||
set:
|
||||
l1: lab1
|
||||
l2: lab2
|
||||
l5: lab5
|
||||
l6: lab6
|
||||
global:
|
||||
labels:
|
||||
gl1: glab1
|
||||
gl2: glab2
|
||||
secret:
|
||||
some-name:
|
||||
enabled: true
|
||||
labels:
|
||||
label1: "{{ .Values.l1 }}"
|
||||
label2: "{{ .Values.l2 }}"
|
||||
label3: lab3
|
||||
label4: lab4
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
some-other-name:
|
||||
enabled: true
|
||||
labels:
|
||||
label5: "{{ .Values.l5 }}"
|
||||
label6: "{{ .Values.l6 }}"
|
||||
label7: lab7
|
||||
label8: lab8
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: Secret
|
||||
- equal:
|
||||
path: type
|
||||
value: Opaque
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-other-name
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
label5: lab5
|
||||
label6: lab6
|
||||
label7: lab7
|
||||
label8: lab8
|
||||
gl1: glab1
|
||||
gl2: glab2
|
||||
|
||||
- it: should pass with multiple secret created and annotations and global annotations added from tpl (1/2)
|
||||
documentIndex: *secretDoc
|
||||
set:
|
||||
a1: anno1
|
||||
a2: anno2
|
||||
a5: anno5
|
||||
a6: anno6
|
||||
global:
|
||||
annotations:
|
||||
ga1: ganno1
|
||||
ga2: ganno2
|
||||
secret:
|
||||
some-name:
|
||||
enabled: true
|
||||
annotations:
|
||||
annotation1: "{{ .Values.a1 }}"
|
||||
annotation2: "{{ .Values.a2 }}"
|
||||
annotation3: anno3
|
||||
annotation4: anno4
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
some-other-name:
|
||||
enabled: true
|
||||
annotations:
|
||||
annotation5: "{{ .Values.a5 }}"
|
||||
annotation6: "{{ .Values.a6 }}"
|
||||
annotation7: anno7
|
||||
annotation8: anno8
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: Secret
|
||||
- equal:
|
||||
path: type
|
||||
value: Opaque
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
annotation1: anno1
|
||||
annotation2: anno2
|
||||
annotation3: anno3
|
||||
annotation4: anno4
|
||||
ga1: ganno1
|
||||
ga2: ganno2
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-name
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with multiple secret created and annotations and global annotations added from tpl (2/2)
|
||||
documentIndex: *otherSecretDoc
|
||||
set:
|
||||
a1: anno1
|
||||
a2: anno2
|
||||
a5: anno5
|
||||
a6: anno6
|
||||
global:
|
||||
annotations:
|
||||
ga1: ganno1
|
||||
ga2: ganno2
|
||||
secret:
|
||||
some-name:
|
||||
enabled: true
|
||||
annotations:
|
||||
annotation1: "{{ .Values.a1 }}"
|
||||
annotation2: "{{ .Values.a2 }}"
|
||||
annotation3: anno3
|
||||
annotation4: anno4
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
some-other-name:
|
||||
enabled: true
|
||||
annotations:
|
||||
annotation5: "{{ .Values.a5 }}"
|
||||
annotation6: "{{ .Values.a6 }}"
|
||||
annotation7: anno7
|
||||
annotation8: anno8
|
||||
content:
|
||||
key1: value1
|
||||
key2: value2
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: Secret
|
||||
- equal:
|
||||
path: type
|
||||
value: Opaque
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
annotation5: anno5
|
||||
annotation6: anno6
|
||||
annotation7: anno7
|
||||
annotation8: anno8
|
||||
ga1: ganno1
|
||||
ga2: ganno2
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-other-name
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with 1 secret created with custom type set
|
||||
documentIndex: &secretDoc 0
|
||||
set:
|
||||
secret:
|
||||
some-name:
|
||||
enabled: true
|
||||
secretType: myCustomType
|
||||
content:
|
||||
key1: false
|
||||
key2: value2
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- isKind:
|
||||
of: Secret
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-name
|
||||
- equal:
|
||||
path: type
|
||||
value: myCustomType
|
||||
- equal:
|
||||
path: stringData
|
||||
value:
|
||||
key1: "false"
|
||||
key2: value2
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
@@ -1,401 +0,0 @@
|
||||
suite: service test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail with multiple services, without any set as primary
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
port: 65535
|
||||
main2:
|
||||
enabled: true
|
||||
primary: false
|
||||
ports:
|
||||
main2:
|
||||
enabled: true
|
||||
port: 65534
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: At least one Service must be set as primary
|
||||
|
||||
- it: should fail without externalName on ExternalName service
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalName
|
||||
externalName: ""
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: <externalName> is required when service type is set to ExternalName
|
||||
|
||||
- it: should fail with invalid externalTrafficPolicy
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
externalTrafficPolicy: invalid_traffic_policy
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid option (invalid_traffic_policy) for <externalTrafficPolicy>. Valid options are Cluster and Local
|
||||
|
||||
- it: should fail with invalid sessionAffinity
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
sessionAffinity: invalid_affinity
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid option (invalid_affinity) for <sessionAffinity>. Valid options are ClientIP and None
|
||||
|
||||
- it: should fail with invalid timeoutSeconds in sessionAffinityConfig negative
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: -1
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid value (-1) for <sessionAffinityConfig.ClientIP.timeoutSeconds>. Valid values must be with 0 and 86400
|
||||
|
||||
- it: should fail with invalid timeoutSeconds in sessionAffinityConfig too high
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 86401
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid value (86401) for <sessionAffinityConfig.ClientIP.timeoutSeconds>. Valid values must be with 0 and 86400
|
||||
|
||||
- it: should fail with invalid ipFamilyPolicy
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ipFamilyPolicy: invalid_fam_policy
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid option (invalid_fam_policy) for <ipFamilyPolicy>. Valid options are SingleStack, PreferDualStack, RequireDualStack
|
||||
|
||||
- it: should fail with invalid ipFamily
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ipFamilies:
|
||||
- invalid_family
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Invalid option (invalid_family) for <ipFamilies[]>. Valid options are IPv4 and IPv6
|
||||
|
||||
- it: should fail with externalIP type but no externalIP defined
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalIP
|
||||
externalIP: []
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Service type is set to ExternalIP, but no externalIP is defined.
|
||||
|
||||
- it: should pass with correct apiVersion
|
||||
documentIndex: &serviceDoc 1
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Service
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
|
||||
- it: should pass with correct name
|
||||
documentIndex: *serviceDoc
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with nameOverride on other service
|
||||
documentIndex: &otherServiceDoc 2
|
||||
set:
|
||||
service:
|
||||
other:
|
||||
enabled: true
|
||||
nameOverride: something
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
port: 80
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-something
|
||||
|
||||
- it: should pass with addAnnotations set to true
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
addAnnotations:
|
||||
traefik: true
|
||||
metallb: true
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
main:
|
||||
protocol: HTTPS
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
traefik.ingress.kubernetes.io/service.serversscheme: https
|
||||
metallb.universe.tf/allow-shared-ip: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with addAnnotations set to false
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
addAnnotations:
|
||||
traefik: false
|
||||
metallb: false
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
main:
|
||||
protocol: HTTPS
|
||||
asserts:
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
|
||||
- it: should pass with addAnnotations set to true and annotations
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
addAnnotations:
|
||||
traefik: true
|
||||
metallb: true
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
annotations:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
ports:
|
||||
main:
|
||||
protocol: HTTPS
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
traefik.ingress.kubernetes.io/service.serversscheme: https
|
||||
metallb.universe.tf/allow-shared-ip: RELEASE-NAME-common-test
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
|
||||
- it: should pass with addAnnotations set to true and global annotations
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
global:
|
||||
annotations:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
addAnnotations:
|
||||
traefik: true
|
||||
metallb: true
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
main:
|
||||
protocol: HTTPS
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
traefik.ingress.kubernetes.io/service.serversscheme: https
|
||||
metallb.universe.tf/allow-shared-ip: RELEASE-NAME-common-test
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
|
||||
- it: should pass with addAnnotations set to true and overridden metalLBSharedKey
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
addAnnotations:
|
||||
traefik: true
|
||||
metallb: true
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
metalLBSharedKey: custom-shared-key
|
||||
ports:
|
||||
main:
|
||||
protocol: HTTPS
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
traefik.ingress.kubernetes.io/service.serversscheme: https
|
||||
metallb.universe.tf/allow-shared-ip: custom-shared-key
|
||||
|
||||
- it: should pass with labels
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
labels:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
|
||||
- it: should pass with labels and global labels
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
global:
|
||||
labels:
|
||||
some_key2: value2
|
||||
some_key3: value3
|
||||
service:
|
||||
main:
|
||||
labels:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
some_key2: value2
|
||||
some_key3: value3
|
||||
|
||||
- it: should pass with labels (Endpoints)
|
||||
documentIndex: &endpointsDoc 2
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalIP
|
||||
externalIP: 10.10.10.100
|
||||
labels:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Endpoints
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
|
||||
- it: should pass with labels and global labels (Endpoints)
|
||||
documentIndex: *endpointsDoc
|
||||
set:
|
||||
global:
|
||||
labels:
|
||||
some_key2: value2
|
||||
some_key3: value3
|
||||
service:
|
||||
main:
|
||||
type: ExternalIP
|
||||
externalIP: 10.10.10.100
|
||||
labels:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
some_key2: value2
|
||||
some_key3: value3
|
||||
|
||||
- it: should pass with annotations (Endpoints)
|
||||
documentIndex: *endpointsDoc
|
||||
set:
|
||||
addAnnotations:
|
||||
traefik: true
|
||||
metallb: true
|
||||
service:
|
||||
main:
|
||||
type: ExternalIP
|
||||
externalIP: 10.10.10.100
|
||||
annotations:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
|
||||
- it: should pass with global annotations (Endpoints)
|
||||
documentIndex: *endpointsDoc
|
||||
set:
|
||||
global:
|
||||
annotations:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
service:
|
||||
main:
|
||||
type: ExternalIP
|
||||
externalIP: 10.10.10.100
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
some_key: value
|
||||
some_key1: value1
|
||||
@@ -1,294 +0,0 @@
|
||||
|
||||
suite: service test clusterIP
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should pass with correct apiVersion
|
||||
documentIndex: &serviceDoc 1
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Service
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
|
||||
- it: should pass with ClusterIP service type
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ClusterIP
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ClusterIP
|
||||
ports: &defaultPort
|
||||
- name: main
|
||||
port: 65535
|
||||
protocol: TCP
|
||||
targetPort: main
|
||||
publishNotReadyAddresses: false
|
||||
selector: &defaultSelector
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: common-test
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with ClusterIP service type and clusterIP set
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ClusterIP
|
||||
clusterIP: 172.16.0.12
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ClusterIP
|
||||
clusterIP: 172.16.0.12
|
||||
publishNotReadyAddresses: false
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
|
||||
- it: should pass with ClusterIP service type and externalTrafficPolicy
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ClusterIP
|
||||
externalTrafficPolicy: Cluster
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ClusterIP
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
- isNull:
|
||||
path: spec.externalTrafficPolicy
|
||||
|
||||
- it: should pass with ClusterIP service type and sessionAffinity set to None
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ClusterIP
|
||||
sessionAffinity: None
|
||||
sessionAffinityConfig:
|
||||
ClientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ClusterIP
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
sessionAffinity: None
|
||||
- isNull:
|
||||
path: spec.sessionAffinityConfig
|
||||
|
||||
- it: should pass with ClusterIP service type and sessionAffinity set to ClientIP
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ClusterIP
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ClusterIP
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
|
||||
- it: should pass with ClusterIP service type and sessionAffinity set to ClientIP from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
timeout: 1000
|
||||
service:
|
||||
main:
|
||||
type: ClusterIP
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ClusterIP
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
|
||||
- it: should pass with ClusterIP service type and externalIPs
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ClusterIP
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ClusterIP
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
|
||||
- it: should pass with ClusterIP service type and externalIPs from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
ip1: 192.168.1.20
|
||||
ip2: 192.168.1.21
|
||||
ip3: 192.168.1.22
|
||||
service:
|
||||
main:
|
||||
type: ClusterIP
|
||||
externalIPs:
|
||||
- "{{ .Values.ip1 }}"
|
||||
- "{{ .Values.ip2 }}"
|
||||
- "{{ .Values.ip3 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ClusterIP
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
|
||||
- it: should pass with ClusterIP service type and publishNotReadyAddresses
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ClusterIP
|
||||
publishNotReadyAddresses: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ClusterIP
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
publishNotReadyAddresses: true
|
||||
|
||||
- it: should pass with ClusterIP service type and ipFamilyPolicy
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ClusterIP
|
||||
ipFamilyPolicy: SingleStack
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ClusterIP
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
ipFamilyPolicy: SingleStack
|
||||
|
||||
- it: should pass with ClusterIP service type and ipFamilies
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ClusterIP
|
||||
ipFamilies:
|
||||
- IPv6
|
||||
- IPv4
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ClusterIP
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
ipFamilies:
|
||||
- IPv6
|
||||
- IPv4
|
||||
|
||||
- it: should pass with ClusterIP service type and custom selector
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ClusterIP
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
|
||||
- it: should pass with ClusterIP service type and custom selector from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
k1: some_value
|
||||
k2: some_value1
|
||||
service:
|
||||
main:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
some_key: "{{ .Values.k1 }}"
|
||||
some_key1: "{{ .Values.k2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ClusterIP
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
@@ -1,269 +0,0 @@
|
||||
suite: service test ExternalIP
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should pass with correct apiVersion
|
||||
documentIndex: &serviceDoc 1
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Service
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
|
||||
- it: should pass with ExternalIP service type
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalIP
|
||||
externalIP: 10.10.10.100
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
publishNotReadyAddresses: false
|
||||
ports: &defaultPort
|
||||
- name: main
|
||||
port: 65535
|
||||
protocol: TCP
|
||||
targetPort: main
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.type
|
||||
|
||||
- it: should pass with ExternalIP service type (Endpoint)
|
||||
documentIndex: &endpointDoc 2
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalIP
|
||||
externalIP: 10.10.10.100
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Endpoints
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
- equal:
|
||||
path: subsets[0]
|
||||
value:
|
||||
addresses:
|
||||
- 10.10.10.100
|
||||
ports:
|
||||
- port: 65535
|
||||
name: main
|
||||
|
||||
- it: should pass with ExternalIP service type with multiple ports (Endpoint)
|
||||
documentIndex: &endpointDoc 2
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalIP
|
||||
externalIP: 10.10.10.100
|
||||
ports:
|
||||
main:
|
||||
enabled: true
|
||||
port: 65535
|
||||
main2:
|
||||
enabled: true
|
||||
port: 65534
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Endpoints
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: subsets[0]
|
||||
value:
|
||||
addresses:
|
||||
- 10.10.10.100
|
||||
ports:
|
||||
- port: 65535
|
||||
name: main
|
||||
- port: 65534
|
||||
name: main2
|
||||
|
||||
- it: should pass with ExternalIP service type and externalTrafficPolicy
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalIP
|
||||
externalIP: 10.10.10.100
|
||||
externalTrafficPolicy: Cluster
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
publishNotReadyAddresses: false
|
||||
ports: *defaultPort
|
||||
externalTrafficPolicy: Cluster
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.type
|
||||
|
||||
- it: should pass with ExternalIP service type and sessionAffinity set to None
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalIP
|
||||
externalIP: 10.10.10.100
|
||||
sessionAffinity: None
|
||||
sessionAffinityConfig:
|
||||
ClientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
publishNotReadyAddresses: false
|
||||
ports: *defaultPort
|
||||
sessionAffinity: None
|
||||
- isNull:
|
||||
path: spec.sessionAffinityConfig
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.type
|
||||
|
||||
- it: should pass with ExternalIP service type and sessionAffinity set to ClientIP
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalIP
|
||||
externalIP: 10.10.10.100
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
publishNotReadyAddresses: false
|
||||
ports: *defaultPort
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.type
|
||||
|
||||
- it: should pass with ExternalIP service type and sessionAffinity set to ClientIP from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
timeout: 1000
|
||||
service:
|
||||
main:
|
||||
type: ExternalIP
|
||||
externalIP: 10.10.10.100
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
publishNotReadyAddresses: false
|
||||
ports: *defaultPort
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.type
|
||||
|
||||
- it: should pass with ExternalIP service type and externalIPs
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalIP
|
||||
externalIP: 10.10.10.100
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
publishNotReadyAddresses: false
|
||||
ports: *defaultPort
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.type
|
||||
|
||||
- it: should pass with ExternalIP service type and externalIPs from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
ip1: 192.168.1.20
|
||||
ip2: 192.168.1.21
|
||||
ip3: 192.168.1.22
|
||||
service:
|
||||
main:
|
||||
type: ExternalIP
|
||||
externalIP: 10.10.10.100
|
||||
externalIPs:
|
||||
- "{{ .Values.ip1 }}"
|
||||
- "{{ .Values.ip2 }}"
|
||||
- "{{ .Values.ip3 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
publishNotReadyAddresses: false
|
||||
ports: *defaultPort
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.type
|
||||
|
||||
- it: should pass with ExternalIP service type and publishNotReadyAddresses
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalIP
|
||||
externalIP: 10.10.10.100
|
||||
publishNotReadyAddresses: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: true
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.type
|
||||
@@ -1,247 +0,0 @@
|
||||
suite: service test ExternalName
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should pass with correct apiVersion
|
||||
documentIndex: &serviceDoc 1
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Service
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
|
||||
- it: should pass with ExternalName service type
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalName
|
||||
externalName: some_hostname
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ExternalName
|
||||
externalName: some_hostname
|
||||
publishNotReadyAddresses: false
|
||||
ports: &defaultPort
|
||||
- name: main
|
||||
port: 65535
|
||||
protocol: TCP
|
||||
targetPort: main
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.ipFamilies
|
||||
- isNull:
|
||||
path: spec.ipFamilyPolicy
|
||||
|
||||
- it: should pass with ExternalName service type and externalTrafficPolicy
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalName
|
||||
externalTrafficPolicy: Cluster
|
||||
externalName: some_hostname
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ExternalName
|
||||
externalName: some_hostname
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
externalTrafficPolicy: Cluster
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.ipFamilies
|
||||
- isNull:
|
||||
path: spec.ipFamilyPolicy
|
||||
|
||||
- it: should pass with ExternalName service type and sessionAffinity set to None
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalName
|
||||
externalName: some_hostname
|
||||
sessionAffinity: None
|
||||
sessionAffinityConfig:
|
||||
ClientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ExternalName
|
||||
externalName: some_hostname
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
sessionAffinity: None
|
||||
- isNull:
|
||||
path: spec.sessionAffinityConfig
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.ipFamilies
|
||||
- isNull:
|
||||
path: spec.ipFamilyPolicy
|
||||
|
||||
- it: should pass with ExternalName service type and sessionAffinity set to ClientIP
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalName
|
||||
externalName: some_hostname
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ExternalName
|
||||
externalName: some_hostname
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.ipFamilies
|
||||
- isNull:
|
||||
path: spec.ipFamilyPolicy
|
||||
|
||||
- it: should pass with ExternalName service type and sessionAffinity set to ClientIP from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
timeout: 1000
|
||||
service:
|
||||
main:
|
||||
type: ExternalName
|
||||
externalName: some_hostname
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ExternalName
|
||||
externalName: some_hostname
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.ipFamilies
|
||||
- isNull:
|
||||
path: spec.ipFamilyPolicy
|
||||
|
||||
- it: should pass with ExternalName service type and externalIPs
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalName
|
||||
externalName: some_hostname
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ExternalName
|
||||
externalName: some_hostname
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.ipFamilies
|
||||
- isNull:
|
||||
path: spec.ipFamilyPolicy
|
||||
|
||||
- it: should pass with ExternalName service type and externalIPs from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
ip1: 192.168.1.20
|
||||
ip2: 192.168.1.21
|
||||
ip3: 192.168.1.22
|
||||
service:
|
||||
main:
|
||||
type: ExternalName
|
||||
externalName: some_hostname
|
||||
externalIPs:
|
||||
- "{{ .Values.ip1 }}"
|
||||
- "{{ .Values.ip2 }}"
|
||||
- "{{ .Values.ip3 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ExternalName
|
||||
externalName: some_hostname
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.ipFamilies
|
||||
- isNull:
|
||||
path: spec.ipFamilyPolicy
|
||||
|
||||
- it: should pass with ExternalName service type and publishNotReadyAddresses
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: ExternalName
|
||||
externalName: some_hostname
|
||||
publishNotReadyAddresses: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ExternalName
|
||||
externalName: some_hostname
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: true
|
||||
- isNull:
|
||||
path: spec.selector
|
||||
- isNull:
|
||||
path: spec.ipFamilies
|
||||
- isNull:
|
||||
path: spec.ipFamilyPolicy
|
||||
@@ -1,378 +0,0 @@
|
||||
suite: service test LoadBalancer
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should pass with correct apiVersion
|
||||
documentIndex: &serviceDoc 1
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Service
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
|
||||
- it: should pass with LoadBalancer service type
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: &defaultPort
|
||||
- name: main
|
||||
port: 65535
|
||||
protocol: TCP
|
||||
targetPort: main
|
||||
publishNotReadyAddresses: false
|
||||
selector: &defaultSelector
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: common-test
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with LoadBalancer service type and loadBalancerIP set
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
loadBalancerIP: 10.16.0.12
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
loadBalancerIP: 10.16.0.12
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
|
||||
- it: should pass with LoadBalancer service type and loadBalancerSourceRanges set
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
loadBalancerSourceRanges:
|
||||
- 10.16.0.14
|
||||
- 10.16.0.15
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
loadBalancerSourceRanges:
|
||||
- 10.16.0.14
|
||||
- 10.16.0.15
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
|
||||
- it: should pass with LoadBalancer service type and loadBalancerSourceRanges set from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
ip1: 10.16.0.14
|
||||
ip2: 10.16.0.15
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
loadBalancerSourceRanges:
|
||||
- "{{ .Values.ip1 }}"
|
||||
- "{{ .Values.ip2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
loadBalancerSourceRanges:
|
||||
- 10.16.0.14
|
||||
- 10.16.0.15
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
|
||||
- it: should pass with LoadBalancer service type, loadBalancerIP and loadBalancerSourceRanges set from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
ip1: 10.16.0.14
|
||||
ip2: 10.16.0.15
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
loadBalancerIP: 10.16.0.12
|
||||
loadBalancerSourceRanges:
|
||||
- "{{ .Values.ip1 }}"
|
||||
- "{{ .Values.ip2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
loadBalancerIP: 10.16.0.12
|
||||
loadBalancerSourceRanges:
|
||||
- 10.16.0.14
|
||||
- 10.16.0.15
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
|
||||
- it: should pass with LoadBalancer service type and clusterIP set
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
clusterIP: 172.16.0.12
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
clusterIP: 172.16.0.12
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
|
||||
- it: should pass with LoadBalancer service type and externalTrafficPolicy
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
externalTrafficPolicy: Cluster
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
externalTrafficPolicy: Cluster
|
||||
|
||||
- it: should pass with LoadBalancer service type and sessionAffinity set to None
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
sessionAffinity: None
|
||||
sessionAffinityConfig:
|
||||
ClientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
sessionAffinity: None
|
||||
- isNull:
|
||||
path: spec.sessionAffinityConfig
|
||||
|
||||
- it: should pass with LoadBalancer service type and sessionAffinity set to ClientIP
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
|
||||
- it: should pass with LoadBalancer service type and sessionAffinity set to ClientIP from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
timeout: 1000
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
|
||||
- it: should pass with LoadBalancer service type and externalIPs
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
|
||||
- it: should pass with LoadBalancer service type and externalIPs from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
ip1: 192.168.1.20
|
||||
ip2: 192.168.1.21
|
||||
ip3: 192.168.1.22
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
externalIPs:
|
||||
- "{{ .Values.ip1 }}"
|
||||
- "{{ .Values.ip2 }}"
|
||||
- "{{ .Values.ip3 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
|
||||
- it: should pass with LoadBalancer service type and publishNotReadyAddresses
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
publishNotReadyAddresses: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
publishNotReadyAddresses: true
|
||||
|
||||
- it: should pass with LoadBalancer service type and ipFamilyPolicy
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
ipFamilyPolicy: SingleStack
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
ipFamilyPolicy: SingleStack
|
||||
|
||||
- it: should pass with LoadBalancer service type and ipFamilies
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
ipFamilies:
|
||||
- IPv6
|
||||
- IPv4
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
ipFamilies:
|
||||
- IPv6
|
||||
- IPv4
|
||||
|
||||
- it: should pass with LoadBalancer service type and custom selector
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
selector:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
|
||||
- it: should pass with LoadBalancer service type and custom selector from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
k1: some_value
|
||||
k2: some_value1
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
selector:
|
||||
some_key: "{{ .Values.k1 }}"
|
||||
some_key1: "{{ .Values.k2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: LoadBalancer
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
@@ -1,344 +0,0 @@
|
||||
suite: service test NodePort
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail with nodePort less than the minimum allowed
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 8999
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Port number (8999) for (main) is too low. The minimum port for Node Port is (9000)
|
||||
|
||||
- it: should pass with correct apiVersion
|
||||
documentIndex: &serviceDoc 1
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Service
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
|
||||
- it: should pass with NodePort service type
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: &defaultPort
|
||||
- name: main
|
||||
port: 65535
|
||||
protocol: TCP
|
||||
targetPort: main
|
||||
nodePort: 35000
|
||||
publishNotReadyAddresses: false
|
||||
selector: &defaultSelector
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: common-test
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with NodePort service type and clusterIP set
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
clusterIP: 172.16.0.12
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
clusterIP: 172.16.0.12
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
|
||||
- it: should pass with NodePort service type and externalTrafficPolicy
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
externalTrafficPolicy: Cluster
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
externalTrafficPolicy: Cluster
|
||||
|
||||
- it: should pass with NodePort service type and sessionAffinity set to None
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
sessionAffinity: None
|
||||
sessionAffinityConfig:
|
||||
ClientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
sessionAffinity: None
|
||||
- isNull:
|
||||
path: spec.sessionAffinityConfig
|
||||
|
||||
- it: should pass with NodePort service type and sessionAffinity set to ClientIP
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
|
||||
- it: should pass with NodePort service type and sessionAffinity set to ClientIP from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
timeout: 1000
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 1000
|
||||
|
||||
- it: should pass with NodePort service type and externalIPs
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
|
||||
- it: should pass with NodePort service type and externalIPs from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
ip1: 192.168.1.20
|
||||
ip2: 192.168.1.21
|
||||
ip3: 192.168.1.22
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
externalIPs:
|
||||
- "{{ .Values.ip1 }}"
|
||||
- "{{ .Values.ip2 }}"
|
||||
- "{{ .Values.ip3 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
externalIPs:
|
||||
- 192.168.1.20
|
||||
- 192.168.1.21
|
||||
- 192.168.1.22
|
||||
|
||||
- it: should pass with NodePort service type and publishNotReadyAddresses
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
publishNotReadyAddresses: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
selector: *defaultSelector
|
||||
publishNotReadyAddresses: true
|
||||
|
||||
- it: should pass with NodePort service type and ipFamilyPolicy
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
ipFamilyPolicy: SingleStack
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
ipFamilyPolicy: SingleStack
|
||||
|
||||
- it: should pass with NodePort service type and ipFamilies
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
ipFamilies:
|
||||
- IPv6
|
||||
- IPv4
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector: *defaultSelector
|
||||
ipFamilies:
|
||||
- IPv6
|
||||
- IPv4
|
||||
|
||||
- it: should pass with NodePort service type and custom selector
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
selector:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
|
||||
- it: should pass with NodePort service type and custom selector from tpl
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
k1: some_value
|
||||
k2: some_value1
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
ports:
|
||||
main:
|
||||
nodePort: 35000
|
||||
selector:
|
||||
some_key: "{{ .Values.k1 }}"
|
||||
some_key1: "{{ .Values.k2 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: NodePort
|
||||
ports: *defaultPort
|
||||
publishNotReadyAddresses: false
|
||||
selector:
|
||||
some_key: some_value
|
||||
some_key1: some_value1
|
||||
@@ -1,73 +0,0 @@
|
||||
|
||||
suite: service test hostNetwork
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should pass with correct apiVersion
|
||||
documentIndex: &serviceDoc 1
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Service
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
|
||||
- it: should pass with hostNetwork enabled
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
hostNetwork: true
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ClusterIP
|
||||
ports: &defaultPort
|
||||
- name: main
|
||||
port: 65535
|
||||
protocol: TCP
|
||||
targetPort: main
|
||||
publishNotReadyAddresses: false
|
||||
selector: &defaultSelector
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: common-test
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with hostPort defined, should be forced to ClusterIP
|
||||
documentIndex: *serviceDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
main:
|
||||
port: 65535
|
||||
hostPort: 12345
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec
|
||||
value:
|
||||
type: ClusterIP
|
||||
ports: &defaultPort
|
||||
- name: main
|
||||
port: 65535
|
||||
protocol: TCP
|
||||
targetPort: main
|
||||
publishNotReadyAddresses: false
|
||||
selector: &defaultSelector
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: common-test
|
||||
release: RELEASE-NAME
|
||||
@@ -1,164 +0,0 @@
|
||||
|
||||
suite: service account test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
|
||||
- it: should fail with multiple service accounts, without any set as primary
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
main2:
|
||||
enabled: true
|
||||
primary: false
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: At least one Service Account must be set as primary
|
||||
|
||||
- it: should pass with service account enabled
|
||||
documentIndex: &serviceAccountDoc 0
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ServiceAccount
|
||||
- isAPIVersion:
|
||||
of: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
- equal:
|
||||
path: automountServiceAccountToken
|
||||
value: true
|
||||
|
||||
- it: should pass with service account enabled
|
||||
documentIndex: *serviceAccountDoc
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
automountServiceAccountToken: false
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
- equal:
|
||||
path: automountServiceAccountToken
|
||||
value: false
|
||||
|
||||
- it: should pass with primary service account enabled and nameOverride defined
|
||||
documentIndex: *serviceAccountDoc
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
nameOverride: some-name
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-name
|
||||
|
||||
- it: should pass with primary service account enabled annotations and labels added
|
||||
documentIndex: *serviceAccountDoc
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
annotations:
|
||||
key1: value1
|
||||
key2: value2
|
||||
labels:
|
||||
key3: value3
|
||||
key4: value4
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
key1: value1
|
||||
key2: value2
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
key3: value3
|
||||
key4: value4
|
||||
|
||||
- it: should pass with primary service account enabled annotations and labels added from tpl
|
||||
documentIndex: *serviceAccountDoc
|
||||
set:
|
||||
k1: value1
|
||||
k2: value2
|
||||
k3: value3
|
||||
k4: value4
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
annotations:
|
||||
key1: "{{ .Values.k1 }}"
|
||||
key2: "{{ .Values.k2 }}"
|
||||
labels:
|
||||
key3: "{{ .Values.k3 }}"
|
||||
key4: "{{ .Values.k4 }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
key3: value3
|
||||
key4: value4
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
key1: value1
|
||||
key2: value2
|
||||
|
||||
- it: should pass with non-primary service account enabled and nameOverride defined
|
||||
documentIndex: &serviceAccountDocExtra 1
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
other:
|
||||
enabled: true
|
||||
primary: false
|
||||
nameOverride: some-name
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ServiceAccount
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-some-name
|
||||
@@ -1,60 +0,0 @@
|
||||
suite: statefulset annotation test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &statefulsetDoc 0
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: StatefulSet
|
||||
- isNull:
|
||||
path: metadata.annotations
|
||||
- matchRegex:
|
||||
path: spec.template.metadata.annotations.rollme
|
||||
pattern: "^[a-zA-Z0-9]{5}$"
|
||||
|
||||
- it: should pass with controller and global annotations
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
some_key: some_value
|
||||
controller:
|
||||
annotations:
|
||||
controller_key: controller_value
|
||||
controller_key2: "{{ .Values.some_key }}"
|
||||
global:
|
||||
annotations:
|
||||
global_key: global_value
|
||||
global_key2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
controller_key: controller_value
|
||||
controller_key2: some_value
|
||||
global_key: global_value
|
||||
global_key2: some_value
|
||||
- isNull:
|
||||
path: metadata.annotations.rollme
|
||||
- matchRegex:
|
||||
path: spec.template.metadata.annotations.rollme
|
||||
pattern: "^[a-zA-Z0-9]{5}$"
|
||||
|
||||
- it: should pass with podAnnotations set
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
some_key: some_value2
|
||||
podAnnotations:
|
||||
test: some_value
|
||||
test2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.metadata.annotations
|
||||
content:
|
||||
test2: some_value2
|
||||
test: some_value
|
||||
@@ -1,74 +0,0 @@
|
||||
suite: statefulset strategy test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with strategy changed in StatefulSet
|
||||
documentIndex: &statefulsetDoc 0
|
||||
set:
|
||||
controller:
|
||||
type: StatefulSet
|
||||
strategy: OnDelete
|
||||
rollingUpdate:
|
||||
partition: 5
|
||||
unavailable: 6
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: StatefulSet
|
||||
- equal:
|
||||
path: spec.updateStrategy
|
||||
value:
|
||||
type: OnDelete
|
||||
- isNull:
|
||||
path: spec.updateStrategy.rollingUpdate
|
||||
|
||||
- it: should pass with strategy changed in StatefulSet
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller:
|
||||
type: StatefulSet
|
||||
strategy: RollingUpdate
|
||||
rollingUpdate:
|
||||
partition: 5
|
||||
unavailable: 6
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.updateStrategy
|
||||
value:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
partition: 5
|
||||
maxUnavailable: 6
|
||||
|
||||
- it: should fail with wrong strategy
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller:
|
||||
type: StatefulSet
|
||||
strategy: not_valid_strategy
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Not a valid strategy type for StatefulSet (not_valid_strategy)
|
||||
|
||||
- it: should pass with revisionHistoryLimit changed
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller:
|
||||
type: StatefulSet
|
||||
revisionHistoryLimit: 1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.revisionHistoryLimit
|
||||
value: 1
|
||||
|
||||
- it: should pass with replicas changed
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller:
|
||||
type: StatefulSet
|
||||
replicas: 6
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 6
|
||||
@@ -1,126 +0,0 @@
|
||||
suite: statefulset default test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with controller set to StatefulSet
|
||||
documentIndex: &statefulsetDoc 0
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: StatefulSet
|
||||
- isAPIVersion:
|
||||
of: apps/v1
|
||||
- equal:
|
||||
path: spec.serviceName
|
||||
value: RELEASE-NAME-common-test
|
||||
- equal:
|
||||
path: spec.revisionHistoryLimit
|
||||
value: 3
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.updateStrategy.type
|
||||
value: RollingUpdate
|
||||
- equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: default
|
||||
- equal:
|
||||
path: spec.template.spec.hostNetwork
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.terminationGracePeriodSeconds
|
||||
value: 10
|
||||
- equal:
|
||||
path: spec.template.spec.enableServiceLinks
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.terminationGracePeriodSeconds
|
||||
value: 10
|
||||
- isNull:
|
||||
path: spec.template.spec.hostname
|
||||
- equal:
|
||||
path: spec.template.spec.dnsPolicy
|
||||
value: ClusterFirst
|
||||
- isNull:
|
||||
path: spec.template.spec.dnsConfig
|
||||
- isNull:
|
||||
path: spec.template.spec.priorityClassName
|
||||
- isNull:
|
||||
path: spec.template.spec.schedulerName
|
||||
- isNull:
|
||||
path: spec.template.spec.hostAliases
|
||||
- isNull:
|
||||
path: spec.template.spec.nodeSelector
|
||||
- isNull:
|
||||
path: spec.template.spec.tolerations
|
||||
- isNull:
|
||||
path: spec.template.spec.imagePullSecrets
|
||||
- isNull:
|
||||
path: spec.template.spec.runtimeClassName
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].name
|
||||
value: RELEASE-NAME-common-test
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].image
|
||||
value: repo:tag
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].command
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].args
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].tty
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].stdin
|
||||
value: false
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].lifecycle
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].terminationMessagePath
|
||||
- isNull:
|
||||
path: spec.template.spec.containers[0].terminationMessagePolicy
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 568
|
||||
fsGroupChangePolicy: OnRootMismatch
|
||||
supplementalGroups: []
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 568
|
||||
runAsGroup: 568
|
||||
capabilities:
|
||||
add: []
|
||||
drop:
|
||||
- ALL
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: UTC
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: void
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
value:
|
||||
- mountPath: /shared
|
||||
name: shared
|
||||
- mountPath: /tmp
|
||||
name: tmp
|
||||
- mountPath: /var/logs
|
||||
name: varlogs
|
||||
@@ -1,229 +0,0 @@
|
||||
suite: statefulset generic test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with controller set to StatefulSet
|
||||
documentIndex: &statefulsetDoc 0
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: StatefulSet
|
||||
- isAPIVersion:
|
||||
of: apps/v1
|
||||
|
||||
|
||||
- it: should pass with podSecurityContext changed
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
podSecurityContext:
|
||||
fsGroup: 0
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.securityContext
|
||||
value:
|
||||
fsGroup: 0
|
||||
fsGroupChangePolicy: Always
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
|
||||
|
||||
- it: should pass with podSecurityContext changed
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
capabilities:
|
||||
add:
|
||||
- something
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value:
|
||||
allowPrivilegeEscalation: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
capabilities:
|
||||
add:
|
||||
- something
|
||||
drop:
|
||||
- ALL
|
||||
|
||||
- it: should pass with multiple envs defined via tpl
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
some_string: a_string
|
||||
some_int: 123
|
||||
some_bool: false
|
||||
env:
|
||||
ENVVAR: "{{ .Values.some_string }}"
|
||||
ENVVAR2: "{{ .Values.some_int }}"
|
||||
ENVVAR3: "{{ .Values.some_bool }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].env
|
||||
value:
|
||||
- name: TZ
|
||||
value: "UTC"
|
||||
- name: UMASK
|
||||
value: "002"
|
||||
- name: UMASK_SET
|
||||
value: "002"
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
- name: ENVVAR
|
||||
value: "a_string"
|
||||
- name: ENVVAR2
|
||||
value: "123"
|
||||
- name: ENVVAR3
|
||||
value: "false"
|
||||
|
||||
- it: should pass with image defined in init containers
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
image:
|
||||
repository: some-repo
|
||||
tag: some-tag
|
||||
pullPolicy: Always
|
||||
someImage:
|
||||
repository: some-other-repo
|
||||
tag: some-other-tag
|
||||
pullPolicy: Never
|
||||
additionalContainers:
|
||||
some-name:
|
||||
imageSelector: someImage
|
||||
pullPolicy: Never
|
||||
initContainers:
|
||||
some-name:
|
||||
imageSelector: someImage
|
||||
pullPolicy: Never
|
||||
systemContainers:
|
||||
some-name:
|
||||
imageSelector: someImage
|
||||
pullPolicy: Never
|
||||
installContainers:
|
||||
some-name:
|
||||
imageSelector: someImage
|
||||
pullPolicy: Never
|
||||
asserts:
|
||||
- isSubset:
|
||||
path: spec.template.spec.containers[0]
|
||||
content:
|
||||
image: some-repo:some-tag
|
||||
imagePullPolicy: Always
|
||||
- lengthEqual:
|
||||
path: spec.template.spec.containers
|
||||
count: 2
|
||||
- lengthEqual:
|
||||
path: spec.template.spec.initContainers
|
||||
count: 3
|
||||
|
||||
- it: should pass with added persistence
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
persistence:
|
||||
volume0:
|
||||
type: pvc
|
||||
enabled: true
|
||||
mountPath: /pvc/path
|
||||
volume1:
|
||||
enabled: true
|
||||
type: nfs
|
||||
server: some.server.local
|
||||
path: /nfs/path
|
||||
mountPath: /nfs
|
||||
volume2:
|
||||
enabled: true
|
||||
type: ixVolume
|
||||
datasetName: ix-app
|
||||
mountPath: /ixVol
|
||||
volume3:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: /mnt/pool/test
|
||||
mountPath: /some/path
|
||||
volume4:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
medium: Memory
|
||||
sizeLimit: 1Gi
|
||||
mountPath: /temp-path
|
||||
volume5:
|
||||
type: secret
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "0777"
|
||||
mountPath: /secret-path
|
||||
volume6:
|
||||
type: configMap
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "0777"
|
||||
mountPath: /configmap-path
|
||||
ixVolumes:
|
||||
- /mnt/pool/ix-applications/ix-app
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume0
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME-common-test-volume0
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume1
|
||||
nfs:
|
||||
path: /nfs/path
|
||||
server: some.server.local
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume2
|
||||
hostPath:
|
||||
path: /mnt/pool/ix-applications/ix-app
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume3
|
||||
hostPath:
|
||||
path: /mnt/pool/test
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume4
|
||||
emptyDir:
|
||||
medium: Memory
|
||||
sizeLimit: 1Gi
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume5
|
||||
secret:
|
||||
defaultMode: 511
|
||||
secretName: some_object_name
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: volume6
|
||||
configMap:
|
||||
defaultMode: 511
|
||||
name: some_object_name
|
||||
@@ -1,79 +0,0 @@
|
||||
suite: statefulset label test
|
||||
templates:
|
||||
- common.yaml
|
||||
chart:
|
||||
appVersion: &appVer v1.2.3
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &statefulsetDoc 0
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: StatefulSet
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
- equal:
|
||||
path: spec.selector.matchLabels
|
||||
value:
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: common-test
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with controller and global labels
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
some_key: some_value
|
||||
controller:
|
||||
labels:
|
||||
controller_key: controller_value
|
||||
controller_key2: "{{ .Values.some_key }}"
|
||||
global:
|
||||
labels:
|
||||
global_key: global_value
|
||||
global_key2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
controller_key: controller_value
|
||||
controller_key2: some_value
|
||||
global_key: global_value
|
||||
global_key2: some_value
|
||||
app: common-test
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-test
|
||||
app.kubernetes.io/version: *appVer
|
||||
helm-revision: "0"
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
release: RELEASE-NAME
|
||||
|
||||
- it: should pass with podLabels set
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
some_key: some_value2
|
||||
podLabels:
|
||||
test: some_value
|
||||
test2: "{{ .Values.some_key }}"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.metadata.labels.test2
|
||||
value: some_value2
|
||||
- equal:
|
||||
path: spec.template.metadata.labels.test
|
||||
value: some_value
|
||||
@@ -1,38 +0,0 @@
|
||||
suite: statefulset name test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &statefulsetDoc 0
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: StatefulSet
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with nameOverride
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
nameOverride: overrodename
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-overrodename
|
||||
|
||||
- it: should pass with global.nameOverride
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
nameOverride: overrodename
|
||||
global:
|
||||
nameOverride: globaloverrodename
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-globaloverrodename
|
||||
@@ -1,125 +0,0 @@
|
||||
suite: statefulset vct test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with vct defined in StatefulSet
|
||||
documentIndex: &statefulsetDoc 0
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
volumeClaimTemplates:
|
||||
data:
|
||||
enabled: true
|
||||
mountPath: "/bitnami/mariadb"
|
||||
asserts:
|
||||
- isKind:
|
||||
of: StatefulSet
|
||||
- equal:
|
||||
path: spec.volumeClaimTemplates[0]
|
||||
value:
|
||||
metadata:
|
||||
name: data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 999Gi
|
||||
|
||||
- it: should pass with multiple vct defined in StatefulSet
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
volumeClaimTemplates:
|
||||
data:
|
||||
enabled: true
|
||||
mountPath: "/bitnami/mariadb"
|
||||
other-data:
|
||||
enabled: true
|
||||
mountPath: "/bitnami/mariadb"
|
||||
asserts:
|
||||
- isKind:
|
||||
of: StatefulSet
|
||||
- equal:
|
||||
path: spec.volumeClaimTemplates[0]
|
||||
value:
|
||||
metadata:
|
||||
name: data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 999Gi
|
||||
- equal:
|
||||
path: spec.volumeClaimTemplates[1]
|
||||
value:
|
||||
metadata:
|
||||
name: other-data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 999Gi
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
value:
|
||||
- mountPath: /shared
|
||||
name: shared
|
||||
- mountPath: /tmp
|
||||
name: tmp
|
||||
- mountPath: /var/logs
|
||||
name: varlogs
|
||||
- mountPath: /bitnami/mariadb
|
||||
name: data
|
||||
- mountPath: /bitnami/mariadb
|
||||
name: other-data
|
||||
|
||||
- it: should pass with vct size changed in StatefulSet
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
volumeClaimTemplates:
|
||||
data:
|
||||
enabled: true
|
||||
size: 10Gi
|
||||
mountPath: "/bitnami/mariadb"
|
||||
asserts:
|
||||
- isKind:
|
||||
of: StatefulSet
|
||||
- equal:
|
||||
path: spec.volumeClaimTemplates[0]
|
||||
value:
|
||||
metadata:
|
||||
name: data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
|
||||
- it: should pass with accessMode changed in StatefulSet
|
||||
documentIndex: *statefulsetDoc
|
||||
set:
|
||||
controller.type: StatefulSet
|
||||
volumeClaimTemplates:
|
||||
data:
|
||||
enabled: true
|
||||
size: 10Gi
|
||||
accessMode: ReadWriteMany
|
||||
mountPath: "/bitnami/mariadb"
|
||||
asserts:
|
||||
- isKind:
|
||||
of: StatefulSet
|
||||
- equal:
|
||||
path: spec.volumeClaimTemplates[0]
|
||||
value:
|
||||
metadata:
|
||||
name: data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
@@ -1,116 +0,0 @@
|
||||
|
||||
suite: primary port utils test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 65535
|
||||
scheme: HTTP
|
||||
failureThreshold: 5
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
|
||||
- it: should pass with no port set as primary
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
primary: false
|
||||
protocol: TCP
|
||||
port: 12345
|
||||
probes:
|
||||
liveness:
|
||||
type: auto
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
tcpSocket:
|
||||
port: 12345
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with main port set as primary and other not
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
primary: true
|
||||
protocol: TCP
|
||||
port: 12345
|
||||
other:
|
||||
primary: false
|
||||
protocol: TCP
|
||||
probes:
|
||||
liveness:
|
||||
type: auto
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
tcpSocket:
|
||||
port: 12345
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with different port set as primary
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
primary: false
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
protocol: TCP
|
||||
port: 12345
|
||||
probes:
|
||||
liveness:
|
||||
type: auto
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
tcpSocket:
|
||||
port: 12345
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should fail with more than 1 primary ports
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
main:
|
||||
primary: true
|
||||
other_port:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 1234
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: More than one ports are set as primary in the primary service. This is not supported.
|
||||
@@ -1,485 +0,0 @@
|
||||
|
||||
suite: primary rbac utils test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
|
||||
- it: should fail with more than 1 primary rbac
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
rules: &rules
|
||||
- apiGroups:
|
||||
- something
|
||||
resources:
|
||||
- something
|
||||
verbs:
|
||||
- something
|
||||
subjects: &subjects
|
||||
- kind: something
|
||||
name: something
|
||||
apiGroup: something
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: More than one RBACS are set as primary. This is not supported.
|
||||
|
||||
- it: should pass with no rbac set as primary (Role)
|
||||
documentIndex: &roleDoc 0
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: Role
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with no rbac set as primary (RoleBinding)
|
||||
documentIndex: &roleBindingDoc 1
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: RoleBinding
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with no rbac set as primary (ClusterRole)
|
||||
documentIndex: *roleDoc
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
clusterWide: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: ClusterRole
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with no rbac set as primary (ClusterRoleBinding)
|
||||
documentIndex: *roleBindingDoc
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
clusterWide: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: ClusterRoleBinding
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with main rbac set as primary and other not (Role - main)
|
||||
documentIndex: *roleDoc
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: false
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: Role
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with main rbac set as primary and other not (Role - other)
|
||||
documentIndex: &otherRoleDoc 2
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: false
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: Role
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-other
|
||||
|
||||
- it: should pass with main rbac set as primary and other not (RoleBinding - main)
|
||||
documentIndex: *roleBindingDoc
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: false
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: RoleBinding
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with main rbac set as primary and other not (RoleBinding - other)
|
||||
documentIndex: &otherRoleBindingDoc 3
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: false
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: RoleBinding
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-other
|
||||
|
||||
- it: should pass with main rbac set as primary and other not (ClusterRole - main)
|
||||
documentIndex: *roleDoc
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
clusterWide: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: false
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: ClusterRole
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with main rbac set as primary and other not (ClusterRole - other)
|
||||
documentIndex: *otherRoleDoc
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: false
|
||||
clusterWide: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: ClusterRole
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-other
|
||||
|
||||
- it: should pass with main rbac set as primary and other not (ClusterRoleBinding - main)
|
||||
documentIndex: *roleBindingDoc
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
clusterWide: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: false
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: ClusterRoleBinding
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with main rbac set as primary and other not (ClusterRoleBinding - other)
|
||||
documentIndex: *otherRoleBindingDoc
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: false
|
||||
clusterWide: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: ClusterRoleBinding
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-other
|
||||
|
||||
- it: should pass with other rbac set as primary and main not (Role - main)
|
||||
documentIndex: *roleDoc
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: Role
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-main
|
||||
|
||||
- it: should pass with other rbac set as primary and main not (Role - other)
|
||||
documentIndex: &otherRoleDoc 2
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: Role
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with other rbac set as primary and main not (RoleBinding - main)
|
||||
documentIndex: *roleBindingDoc
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: RoleBinding
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-main
|
||||
|
||||
- it: should pass with other rbac set as primary and main not (RoleBinding - other)
|
||||
documentIndex: &otherRoleBindingDoc 3
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: RoleBinding
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with other rbac set as primary and main not (ClusterRole - main)
|
||||
documentIndex: *roleDoc
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
clusterWide: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: ClusterRole
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-main
|
||||
|
||||
- it: should pass with other rbac set as primary and main not (ClusterRole - other)
|
||||
documentIndex: *otherRoleDoc
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
clusterWide: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: ClusterRole
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with other rbac set as primary and main not (ClusterRoleBinding - main)
|
||||
documentIndex: *roleBindingDoc
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
clusterWide: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: ClusterRoleBinding
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-main
|
||||
|
||||
- it: should pass with other rbac set as primary and main not (ClusterRoleBinding - other)
|
||||
documentIndex: *otherRoleBindingDoc
|
||||
set:
|
||||
rbac:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
clusterWide: true
|
||||
rules: *rules
|
||||
subjects: *subjects
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 7
|
||||
- isKind:
|
||||
of: ClusterRoleBinding
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
@@ -1,114 +0,0 @@
|
||||
|
||||
suite: primary serviceAccount utils test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
|
||||
- it: should fail with more than 1 primary serviceAccounts
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: More than one serviceAccounts are set as primary. This is not supported.
|
||||
|
||||
- it: should pass with no serviceAccount set as primary
|
||||
documentIndex: &serviceAccountDoc 0
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- isKind:
|
||||
of: ServiceAccount
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with main serviceAccount set as primary and other not (check name on main)
|
||||
documentIndex: *serviceAccountDoc
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
other:
|
||||
enabled: true
|
||||
primary: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: ServiceAccount
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
|
||||
- it: should pass with main serviceAccount set as primary and other not (check name on other)
|
||||
documentIndex: &otherServiceAccountDoc 1
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
primary: true
|
||||
other:
|
||||
enabled: true
|
||||
primary: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: ServiceAccount
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-other
|
||||
|
||||
- it: should pass with different serviceAccount set as primary (check name on main)
|
||||
documentIndex: *serviceAccountDoc
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: ServiceAccount
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test-main
|
||||
|
||||
- it: should pass with different serviceAccount set as primary (check name on other)
|
||||
documentIndex: *otherServiceAccountDoc
|
||||
set:
|
||||
serviceAccount:
|
||||
main:
|
||||
enabled: true
|
||||
primary: false
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 5
|
||||
- isKind:
|
||||
of: ServiceAccount
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-test
|
||||
@@ -1,121 +0,0 @@
|
||||
|
||||
suite: primary service utils test
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: should pass with default values
|
||||
documentIndex: &deploymentDoc 0
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 65535
|
||||
scheme: HTTP
|
||||
failureThreshold: 5
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
|
||||
- it: should fail with more than 1 primary services
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
primary: true
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
port: 80
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: More than one services are set as primary. This is not supported.
|
||||
|
||||
|
||||
- it: should pass with main service set as primary and other not
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
primary: true
|
||||
ports:
|
||||
main:
|
||||
protocol: TCP
|
||||
port: 12345
|
||||
other:
|
||||
primary: false
|
||||
ports:
|
||||
main:
|
||||
protocol: TCP
|
||||
probes:
|
||||
liveness:
|
||||
type: auto
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
tcpSocket:
|
||||
port: 12345
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with no service set as primary
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
primary: false
|
||||
ports:
|
||||
main:
|
||||
protocol: TCP
|
||||
port: 12345
|
||||
probes:
|
||||
liveness:
|
||||
type: auto
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
tcpSocket:
|
||||
port: 12345
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
- it: should pass with different service set as primary
|
||||
documentIndex: *deploymentDoc
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
primary: false
|
||||
other:
|
||||
enabled: true
|
||||
primary: true
|
||||
ports:
|
||||
other:
|
||||
enabled: true
|
||||
protocol: TCP
|
||||
port: 12345
|
||||
probes:
|
||||
liveness:
|
||||
type: auto
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe
|
||||
value:
|
||||
tcpSocket:
|
||||
port: 12345
|
||||
initialDelaySeconds: 10
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 10
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user