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

@ -75,3 +75,35 @@ tests:
- sleep
- infinity
- test
- it: args from defaultContainerOptions should pass
set:
controllers.main.defaultContainerOptions:
args: value_of_args
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].args
value:
- value_of_args
- it: args from defaultContainerOptions with container override should pass
set:
controllers.main.defaultContainerOptions:
args: value_of_args
controllers.main.containers.main.args:
- value 1
- value 2
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].args
value:
- value 1
- value 2

View file

@ -73,3 +73,35 @@ tests:
value:
- /bin/sh
- -c
- it: command from defaultContainerOptions should pass
set:
controllers.main.defaultContainerOptions:
command: value_of_command
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].command
value:
- value_of_command
- it: command from defaultContainerOptions with container override should pass
set:
controllers.main.defaultContainerOptions:
command: value_of_command
controllers.main.containers.main.command:
- value 1
- value 2
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].command
value:
- value 1
- value 2

View file

@ -237,3 +237,37 @@ tests:
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

View file

@ -41,6 +41,61 @@ tests:
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:

View file

@ -3,10 +3,10 @@
suite: container image tag
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: string tag should pass
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.containers.main.image:
repository: ghcr.io/mendhak/http-https-echo
@ -21,6 +21,8 @@ tests:
value: ghcr.io/mendhak/http-https-echo:latest
- it: integer tag should pass
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.containers.main.image:
repository: ghcr.io/mendhak/http-https-echo
@ -35,6 +37,8 @@ tests:
value: ghcr.io/mendhak/http-https-echo:1.23
- it: template tag should pass
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.containers.main.image:
repository: ghcr.io/mendhak/http-https-echo
@ -47,3 +51,38 @@ tests:
equal:
path: spec.template.spec.containers[0].image
value: ghcr.io/mendhak/http-https-echo:1.0.0
- it: tag from defaultContainerOptions should pass
set:
controllers.main:
defaultContainerOptions:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 32
containers:
main: {} # needed to have at least a container enabled
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].image
value: ghcr.io/mendhak/http-https-echo:32
- it: tag from defaultContainerOptions with container override should pass
set:
controllers.main.defaultContainerOptions.image:
repository: ghcr.io/mendhak/http-https-echo
tag: 32
controllers.main.containers.main.image:
repository: ghcr.io/mendhak/http-https-echo-override
tag: 33
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].image
value: ghcr.io/mendhak/http-https-echo-override:33

View file

@ -0,0 +1,142 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container resources
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
path: spec.template.spec.containers[0].resources
- it: defaultContainerOption should pass
set:
controllers:
main:
defaultContainerOptions:
resources:
requests:
memory: 1Gi
initContainers:
test:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].resources
value:
requests:
memory: 1Gi
- documentIndex: 0
equal:
path: spec.template.spec.initContainers[0].resources
value:
requests:
memory: 1Gi
- it: defaultContainerOption with container override should pass
set:
controllers:
main:
defaultContainerOptions:
resources:
requests:
memory: 1Gi
containers:
main:
resources:
requests:
memory: 2Gi
initContainers:
test:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].resources
value:
requests:
memory: 2Gi
- documentIndex: 0
equal:
path: spec.template.spec.initContainers[0].resources
value:
requests:
memory: 1Gi
- it: defaultContainerOption with initContainer override should pass
set:
controllers:
main:
defaultContainerOptions:
resources:
requests:
memory: 1Gi
initContainers:
test:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
resources:
requests:
memory: 2Gi
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].resources
value:
requests:
memory: 1Gi
- documentIndex: 0
equal:
path: spec.template.spec.initContainers[0].resources
value:
requests:
memory: 2Gi
- it: defaultContainerOption disabled for initContainer should pass
set:
controllers:
main:
applyDefaultContainerOptionsToInitContainers: false
defaultContainerOptions:
resources:
requests:
memory: 1Gi
initContainers:
test:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].resources
value:
requests:
memory: 1Gi
- documentIndex: 0
notExists:
path: spec.template.spec.initContainers[0].resources

View file

@ -0,0 +1,59 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: container securityContext
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
path: spec.template.spec.containers[0].securityContext
- it: defaultContainerOption should pass
set:
controllers:
main:
defaultContainerOptions:
securityContext:
runAsUser: 1000
runAsGroup: 1000
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].securityContext
value:
runAsUser: 1000
runAsGroup: 1000
- it: defaultContainerOption with container override should pass
set:
controllers:
main:
defaultContainerOptions:
securityContext:
runAsUser: 1000
runAsGroup: 1000
containers:
main:
securityContext:
runAsUser: 568
runAsGroup: 568
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].securityContext
value:
runAsUser: 568
runAsGroup: 568