feat: Bump common library to v3.4.0 (#349)

This commit is contained in:
Bernd Schorgers 2024-08-27 14:16:37 +02:00
parent a78c21ab00
commit 86062681a9
No known key found for this signature in database
GPG key ID: BC5E2BD907F9A8EC
45 changed files with 1023 additions and 149 deletions

View file

@ -0,0 +1,273 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container env 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].env
- it: KeyValue string should pass
set:
controllers.main.containers.main.env:
string: value_of_env
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[0]
value:
name: string
value: value_of_env
- it: KeyValue float should pass
set:
controllers.main.containers.main.env:
string: 4.2
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[0]
value:
name: string
value: "4.2"
- it: KeyValue int should pass
set:
controllers.main.containers.main.env:
string: 1
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[0]
value:
name: string
value: "1"
- it: List should pass
set:
controllers.main.containers.main.env:
- name: STATIC_ENV_FROM_LIST
value: STATIC_ENV_VALUE_FROM_LIST
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[0]
value:
name: STATIC_ENV_FROM_LIST
value: STATIC_ENV_VALUE_FROM_LIST
- it: Explicit ValueFrom in list should pass
set:
controllers.main.containers.main.env:
- name: DYNAMIC_ENV_FROM_LIST
valueFrom:
fieldRef:
fieldPath: spec.nodeName
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[0]
value:
name: DYNAMIC_ENV_FROM_LIST
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- it: Implicit ValueFrom in list should pass
set:
controllers.main.containers.main.env:
- name: DYNAMIC_ENV_FROM_LIST
fieldRef:
fieldPath: spec.nodeName
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[0]
value:
name: DYNAMIC_ENV_FROM_LIST
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- it: Implicit ValueFrom should pass
set:
controllers.main.containers.main.env:
DYNAMIC_ENV:
fieldRef:
fieldPath: spec.nodeName
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[0]
value:
name: DYNAMIC_ENV
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- it: Templated value should pass
set:
controllers.main.containers.main.env:
DYNAMIC_ENV: "{{ .Release.Name }}-admin"
TEMPLATE_ENV:
valueFrom:
secretKeyRef:
name: "{{ .Release.Name }}-secret"
key: "{{ .Release.Name }}-key"
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
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[1]
value:
name: TEMPLATE_ENV
valueFrom:
secretKeyRef:
key: "RELEASE-NAME-key"
name: "RELEASE-NAME-secret"
- it: Combined KeyValue with Explicit ValueFrom should pass
set:
controllers.main.containers.main.env:
STATIC_ENV: static
DYNAMIC_ENV:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[0]
value:
name: DYNAMIC_ENV
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[1]
value:
name: STATIC_ENV
value: static
- it: Env vars with dependsOn should pass
set:
controllers.main.containers.main.env:
STATIC_ENV: 1
DYNAMIC_ENV:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
dependsOn: STATIC_ENV
ORDERED_ENV:
value: true
dependsOn: STATIC_ENV
DEPENDENT_ENV:
value: moo_two
dependsOn:
- DYNAMIC_ENV
- ORDERED_ENV
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[0]
value:
name: STATIC_ENV
value: "1"
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[1]
value:
name: DYNAMIC_ENV
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[2]
value:
name: ORDERED_ENV
value: "true"
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[3]
value:
name: DEPENDENT_ENV
value: moo_two
- it: env from defaultContainerOptions should pass
set:
controllers.main.defaultContainerOptions:
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: env from defaultContainerOptions with container override should pass
set:
controllers.main.defaultContainerOptions:
env:
string: value_of_env
controllers.main.containers.main.env:
someThingElse: value_of_env
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[0]
value:
name: someThingElse
value: value_of_env