feat(common): Release common 4.0.0 (#398)

Co-authored-by: lab-assistant[bot] <180935599+lab-assistant[bot]@users.noreply.github.com>
This commit is contained in:
Bernd Schorgers 2025-05-16 08:40:39 +02:00
parent 1e210f43e3
commit a01a89cb13
No known key found for this signature in database
327 changed files with 11181 additions and 7330 deletions

View file

@ -0,0 +1,30 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - fields - concurrencyPolicy
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.concurrencyPolicy
value: Forbid
- it: custom configuration should pass
set:
controllers.main.cronjob.concurrencyPolicy: Test
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.concurrencyPolicy
value: Test

View file

@ -0,0 +1,30 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - fields - failedJobsHistory
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.failedJobsHistoryLimit
value: 1
- it: custom configuration should pass
set:
controllers.main.cronjob.failedJobsHistory: 2
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.failedJobsHistoryLimit
value: 2

View file

@ -0,0 +1,29 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - fields - parallelism
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- notExists:
path: spec.parallelism
- it: custom configuration should pass
set:
controllers.main.cronjob.parallelism: 3
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.jobTemplate.spec.parallelism
value: 3

View file

@ -0,0 +1,30 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - fields - restartPolicy
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.jobTemplate.spec.template.spec.restartPolicy
value: Never
- it: custom configuration should pass
set:
controllers.main.pod.restartPolicy: OnFailure
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.jobTemplate.spec.template.spec.restartPolicy
value: OnFailure

View file

@ -0,0 +1,30 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - fields - successfulJobsHistory
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.successfulJobsHistoryLimit
value: 1
- it: custom configuration should pass
set:
controllers.main.cronjob.successfulJobsHistory: 3
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.successfulJobsHistoryLimit
value: 3

View file

@ -0,0 +1,30 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - fields - suspend
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.suspend
value: false
- it: custom configuration should pass
set:
controllers.main.cronjob.suspend: true
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.suspend
value: true

View file

@ -0,0 +1,29 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - fields - ttlSecondsAfterFinished
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main.type: cronjob
controllers.main.cronjob.schedule: "*/20 * * * *"
tests:
- it: default configuration should pass
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- notExists:
path: spec.jobTemplate.spec.ttlSecondsAfterFinished
- it: custom configuration should pass
set:
controllers.main.cronjob.ttlSecondsAfterFinished: 3600
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.jobTemplate.spec.ttlSecondsAfterFinished
value: 3600

View file

@ -0,0 +1,49 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - metadata - annotations
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
tests:
- it: no annotations are set by default
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- notExists:
path: metadata.annotations
- it: custom annotations
set:
controllers.main.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
test_annotation: test
- it: custom annotations mixed with global annotations
set:
global.annotations:
global_annotation: test
controllers.main.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test

View file

@ -0,0 +1,25 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - jobTemplate - metadata - annotations
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
tests:
- it: jobTemplate metadata should pass
set:
controllers.main.pod.annotations:
test_annotation: test
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.jobTemplate.spec.template.metadata.annotations
value:
test_annotation: test

View file

@ -0,0 +1,28 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - jobTemplate - metadata - labels
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
tests:
- it: jobTemplate metadata should pass
set:
controllers.main.pod.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: spec.jobTemplate.spec.template.metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME
test_label: test

View file

@ -0,0 +1,65 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - metadata - labels
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
tests:
- it: default labels
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom labels
set:
controllers.main.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom labels mixed with global labels
set:
global.labels:
global_label: test
controllers.main.labels:
test_label: test
documentSelector:
path: $[?(@.kind == "CronJob")].metadata.name
value: release-name
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/controller: main
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test

View file

@ -0,0 +1,219 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: cronjob - metadata - name
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
controllers.main:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
tests:
- it: name defaults to chart fullName
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name
any: true
- it: forceRename
set:
controllers.main.forceRename: forceRename
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: forcerename
any: true
- it: forceRename with template
set:
controllers.main.forceRename: "{{ .Chart.Name }}"
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: common-test
any: true
- it: prefix
set:
controllers.main.prefix: prefix
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: prefix-release-name
any: true
- it: prefix with template
set:
controllers.main.prefix: "{{ .Chart.Name }}-prefix"
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: common-test-prefix-release-name
any: true
- it: suffix
set:
controllers.main.suffix: suffix
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-suffix
any: true
- it: suffix with template
set:
controllers.main.suffix: "{{ .Chart.Name }}-suffix"
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-common-test-suffix
any: true
- it: both prefix and suffix
set:
controllers.main.prefix: prefix
controllers.main.suffix: suffix
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: prefix-release-name-suffix
any: true
- it: prefix, suffix and forceRename (illegal combination)
set:
controllers.main.forceRename: forceRename
controllers.main.prefix: prefix
controllers.main.suffix: suffix
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"
- it: multiple items
set:
controllers:
second:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-main
any: true
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-second
any: true
- it: multiple items with prefix
set:
controllers:
second:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
prefix: prefix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-main
any: true
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: prefix-release-name-second
any: true
- it: multiple items with suffix
set:
controllers:
second:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
suffix: suffix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-main
any: true
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-second-suffix
any: true
- it: multiple items with prefix and suffix
set:
controllers:
second:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
prefix: prefix
suffix: suffix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: release-name-main
any: true
- containsDocument:
kind: CronJob
apiVersion: batch/v1
name: prefix-release-name-second-suffix
any: true
- it: multiple items with prefix, suffix and forceRename (illegal combination)
set:
controllers:
second:
type: cronjob
cronjob:
schedule: "*/20 * * * *"
forceRename: forceRename
prefix: prefix
suffix: suffix
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 31
asserts:
- failedTemplate:
errorPattern: "values don't meet the specifications of the schema"