mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 08:57:04 +02:00
154 lines
3.8 KiB
YAML
154 lines
3.8 KiB
YAML
suite: container env values
|
|
templates:
|
|
- common.yaml
|
|
tests:
|
|
- it: default should pass
|
|
asserts:
|
|
- documentIndex: &DeploymentDoc 0
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *DeploymentDoc
|
|
isNull:
|
|
path: spec.template.spec.containers[0].env
|
|
|
|
- it: KeyValue string should pass
|
|
set:
|
|
env:
|
|
string: value_of_env
|
|
asserts:
|
|
- documentIndex: &DeploymentDoc 0
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *DeploymentDoc
|
|
equal:
|
|
path: spec.template.spec.containers[0].env[0]
|
|
value:
|
|
name: string
|
|
value: value_of_env
|
|
|
|
- it: KeyValue float should pass
|
|
set:
|
|
env:
|
|
string: 4.2
|
|
asserts:
|
|
- documentIndex: &DeploymentDoc 0
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *DeploymentDoc
|
|
equal:
|
|
path: spec.template.spec.containers[0].env[0]
|
|
value:
|
|
name: string
|
|
value: "4.2"
|
|
|
|
- it: KeyValue int should pass
|
|
set:
|
|
env:
|
|
string: 1
|
|
asserts:
|
|
- documentIndex: &DeploymentDoc 0
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *DeploymentDoc
|
|
equal:
|
|
path: spec.template.spec.containers[0].env[0]
|
|
value:
|
|
name: string
|
|
value: "1"
|
|
|
|
- it: List should pass
|
|
set:
|
|
env:
|
|
- name: STATIC_ENV_FROM_LIST
|
|
value: STATIC_ENV_VALUE_FROM_LIST
|
|
asserts:
|
|
- documentIndex: &DeploymentDoc 0
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *DeploymentDoc
|
|
equal:
|
|
path: spec.template.spec.containers[0].env[0]
|
|
value:
|
|
name: STATIC_ENV_FROM_LIST
|
|
value: STATIC_ENV_VALUE_FROM_LIST
|
|
|
|
- it: Explicit ValueFrom in list should pass
|
|
set:
|
|
env:
|
|
- name: DYNAMIC_ENV_FROM_LIST
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: spec.nodeName
|
|
asserts:
|
|
- documentIndex: &DeploymentDoc 0
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *DeploymentDoc
|
|
equal:
|
|
path: spec.template.spec.containers[0].env[0]
|
|
value:
|
|
name: DYNAMIC_ENV_FROM_LIST
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: spec.nodeName
|
|
|
|
- it: Implicit ValueFrom should pass
|
|
set:
|
|
env:
|
|
DYNAMIC_ENV:
|
|
fieldRef:
|
|
fieldPath: spec.nodeName
|
|
asserts:
|
|
- documentIndex: &DeploymentDoc 0
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *DeploymentDoc
|
|
equal:
|
|
path: spec.template.spec.containers[0].env[0]
|
|
value:
|
|
name: DYNAMIC_ENV
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: spec.nodeName
|
|
|
|
- it: Templated value should pass
|
|
set:
|
|
env:
|
|
DYNAMIC_ENV: "{{ .Release.Name }}-admin"
|
|
asserts:
|
|
- documentIndex: &DeploymentDoc 0
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *DeploymentDoc
|
|
equal:
|
|
path: spec.template.spec.containers[0].env[0]
|
|
value:
|
|
name: DYNAMIC_ENV
|
|
value: RELEASE-NAME-admin
|
|
|
|
- it: Combined KeyValue with Explicit ValueFrom should pass
|
|
set:
|
|
env:
|
|
STATIC_ENV: static
|
|
DYNAMIC_ENV:
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: spec.nodeName
|
|
asserts:
|
|
- documentIndex: &DeploymentDoc 0
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *DeploymentDoc
|
|
equal:
|
|
path: spec.template.spec.containers[0].env[0]
|
|
value:
|
|
name: DYNAMIC_ENV
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: spec.nodeName
|
|
- documentIndex: *DeploymentDoc
|
|
equal:
|
|
path: spec.template.spec.containers[0].env[1]
|
|
value:
|
|
name: STATIC_ENV
|
|
value: static
|