mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-03 08:37:03 +02:00
88 lines
2.5 KiB
YAML
88 lines
2.5 KiB
YAML
---
|
|
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
|
suite: pod initContainers
|
|
templates:
|
|
- common.yaml
|
|
tests:
|
|
- it: with custom env vars dict should pass
|
|
set:
|
|
controllers.main.initContainers:
|
|
init1:
|
|
image:
|
|
repository: ghcr.io/mendhak/http-https-echo
|
|
env:
|
|
int: 1
|
|
float: 1.5
|
|
string: value_of_env
|
|
template: "{{ .Release.Name }}-admin"
|
|
asserts:
|
|
- documentIndex: &DeploymentDocument 0
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *DeploymentDocument
|
|
equal:
|
|
path: spec.template.spec.initContainers[0].env[0]
|
|
value:
|
|
name: float
|
|
value: "1.5"
|
|
- documentIndex: *DeploymentDocument
|
|
equal:
|
|
path: spec.template.spec.initContainers[0].env[1]
|
|
value:
|
|
name: int
|
|
value: "1"
|
|
- documentIndex: *DeploymentDocument
|
|
equal:
|
|
path: spec.template.spec.initContainers[0].env[2]
|
|
value:
|
|
name: string
|
|
value: value_of_env
|
|
- documentIndex: *DeploymentDocument
|
|
equal:
|
|
path: spec.template.spec.initContainers[0].env[3]
|
|
value:
|
|
name: template
|
|
value: RELEASE-NAME-admin
|
|
|
|
- it: disabled should pass
|
|
set:
|
|
controllers.main.initContainers:
|
|
init1:
|
|
enabled: false
|
|
image:
|
|
repository: ghcr.io/mendhak/http-https-echo
|
|
asserts:
|
|
- documentIndex: &DeploymentDocument 0
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *DeploymentDocument
|
|
notExists:
|
|
path: spec.template.spec.initContainers
|
|
|
|
- it: custom order should pass
|
|
set:
|
|
controllers.main.initContainers:
|
|
init1:
|
|
order: 2
|
|
image:
|
|
repository: ghcr.io/mendhak/http-https-echo
|
|
init2:
|
|
order: 1
|
|
image:
|
|
repository: ghcr.io/mendhak/http-https-echo
|
|
asserts:
|
|
- documentIndex: &DeploymentDocument 0
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *DeploymentDocument
|
|
lengthEqual:
|
|
path: spec.template.spec.initContainers
|
|
count: 2
|
|
- documentIndex: *DeploymentDocument
|
|
equal:
|
|
path: spec.template.spec.initContainers[0].name
|
|
value: init2
|
|
- documentIndex: *DeploymentDocument
|
|
equal:
|
|
path: spec.template.spec.initContainers[1].name
|
|
value: init1
|