helm-charts/charts/library/common-test/tests/container/field_envfrom_test.yaml
Bernd Schorgers 8b33237e27
feat(common): Release library 3.7.0 (#377)
Signed-off-by: solidDoWant <fred.heinecke@yahoo.com>
Co-authored-by: Patrick Collins <Patricol@users.noreply.github.com>
Co-authored-by: Patrick Collins <patrick.collins@gainbridge.io>
Co-authored-by: Lawrence Gil <larrywtf609@gmail.com>
Co-authored-by: solidDoWant <fred.heinecke@yahoo.com>
2025-02-07 20:03:04 +01:00

195 lines
5.6 KiB
YAML

---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container envFrom values
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
notExists:
path: spec.template.spec.containers[0].envFrom
- it: explicit envFrom should pass
set:
controllers.main.containers.main.envFrom:
- secretRef:
name: myCustomSecret
prefix: test
- configMapRef:
name: myCustomConfig
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].envFrom[0]
value:
secretRef:
name: myCustomSecret
prefix: test
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].envFrom[1]
value:
configMapRef:
name: myCustomConfig
- it: envFrom from defaultContainerOptions should pass
set:
controllers.main.defaultContainerOptions:
envFrom:
- secretRef:
name: myCustomSecret
prefix: test
- configMapRef:
name: myCustomConfig
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].envFrom[0]
value:
secretRef:
name: myCustomSecret
prefix: test
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].envFrom[1]
value:
configMapRef:
name: myCustomConfig
- it: envFrom from defaultContainerOptions with container override should pass
set:
controllers.main.defaultContainerOptions:
envFrom:
- secretRef:
name: myCustomSecret
prefix: test
- configMapRef:
name: myCustomConfig
controllers.main.containers.main.envFrom:
- secretRef:
name: myCustomSecretOverride
prefix: test
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].envFrom[0]
value:
secretRef:
name: myCustomSecretOverride
prefix: test
- documentIndex: *DeploymentDoc
notExists:
path: spec.template.spec.containers[0].envFrom[1]
- it: envFrom configmap identifier reference should pass
set:
controllers.main.containers.main.envFrom:
- configMap: config
prefix: test
- configMapRef:
identifier: config
configMaps:
config:
data:
test: test
asserts:
- documentIndex: &DeploymentDoc 1
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].envFrom[0]
value:
configMapRef:
name: RELEASE-NAME-config
prefix: test
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].envFrom[1]
value:
configMapRef:
name: RELEASE-NAME-config
- it: envFrom Secret identifier reference should pass
set:
controllers.main.containers.main.envFrom:
- secret: secret
prefix: test
- secretRef:
identifier: secret
prefix: test
secrets:
secret:
stringData:
test: test
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].envFrom[0]
value:
secretRef:
name: RELEASE-NAME-secret
prefix: test
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].envFrom[1]
value:
secretRef:
name: RELEASE-NAME-secret
prefix: test
- it: envFrom with templated name reference should pass
set:
controllers.main.containers.main.envFrom:
- configMap: "{{ .Release.Name }}-config"
- configMapRef:
name: "{{ .Release.Name }}-config2"
- secret: "{{ .Release.Name }}-secret"
- secretRef:
name: "{{ .Release.Name }}-secret2"
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].envFrom[0]
value:
configMapRef:
name: RELEASE-NAME-config
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].envFrom[1]
value:
configMapRef:
name: RELEASE-NAME-config2
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].envFrom[2]
value:
secretRef:
name: RELEASE-NAME-secret
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].envFrom[3]
value:
secretRef:
name: RELEASE-NAME-secret2