mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 08:57:04 +02:00
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:
parent
1e210f43e3
commit
a01a89cb13
327 changed files with 11181 additions and 7330 deletions
|
@ -0,0 +1,117 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: configmap - metadata - annotations
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: no annotations are set by default
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].metadata.name
|
||||
value: release-name
|
||||
asserts:
|
||||
- notExists:
|
||||
path: metadata.annotations
|
||||
|
||||
- it: custom annotations
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
annotations:
|
||||
test_annotation: test
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].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
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
annotations:
|
||||
test_annotation: test
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].metadata.name
|
||||
value: release-name
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
global_annotation: test
|
||||
test_annotation: test
|
||||
|
||||
- it: default metadata from folder should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
configMapsFromFolder:
|
||||
enabled: true
|
||||
basePath: ci/configMapsFolder
|
||||
configMapsOverrides:
|
||||
test_2:
|
||||
fileAttributeOverrides:
|
||||
helm.jpg:
|
||||
binary: true
|
||||
test_2.yaml:
|
||||
escaped: true
|
||||
asserts:
|
||||
- documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].metadata.name
|
||||
value: release-name-config
|
||||
notExists:
|
||||
path: metadata.annotations
|
||||
- documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].metadata.name
|
||||
value: release-name-test_1
|
||||
notExists:
|
||||
path: metadata.annotations
|
||||
- documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].metadata.name
|
||||
value: release-name-test_2
|
||||
notExists:
|
||||
path: metadata.annotations
|
||||
|
||||
- it: custom metadata from folder should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
configMapsFromFolder:
|
||||
enabled: true
|
||||
basePath: ci/configMapsFolder
|
||||
configMapsOverrides:
|
||||
test_2:
|
||||
annotations:
|
||||
test: test_annotation
|
||||
fileAttributeOverrides:
|
||||
helm.jpg:
|
||||
binary: true
|
||||
test_2.yaml:
|
||||
escaped: true
|
||||
asserts:
|
||||
- documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].metadata.name
|
||||
value: release-name-test_2
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
test: test_annotation
|
|
@ -1,28 +1,22 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: configmap metadata
|
||||
suite: configmap - metadata - labels
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
- it: default labels
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].metadata.name
|
||||
value: release-name
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &ConfigmapDocument 0
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *ConfigmapDocument
|
||||
notExists:
|
||||
path: metadata.annotations
|
||||
- documentIndex: *ConfigmapDocument
|
||||
equal:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
|
@ -30,29 +24,19 @@ tests:
|
|||
app.kubernetes.io/name: RELEASE-NAME
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
|
||||
- it: custom metadata should pass
|
||||
- it: custom labels
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].metadata.name
|
||||
value: release-name
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &ConfigmapDocument 0
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *ConfigmapDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
test_annotation: test
|
||||
- documentIndex: *ConfigmapDocument
|
||||
equal:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
|
@ -61,35 +45,21 @@ tests:
|
|||
helm.sh/chart: common-test-1.0.0
|
||||
test_label: test
|
||||
|
||||
- it: custom metadata with global metadata should pass
|
||||
- it: custom labels mixed with global labels
|
||||
set:
|
||||
global:
|
||||
labels:
|
||||
global_label: test
|
||||
annotations:
|
||||
global_annotation: test
|
||||
global.labels:
|
||||
global_label: test
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].metadata.name
|
||||
value: release-name
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &ConfigmapDocument 0
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *ConfigmapDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
global_annotation: test
|
||||
test_annotation: test
|
||||
- documentIndex: *ConfigmapDocument
|
||||
equal:
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
|
@ -99,19 +69,6 @@ tests:
|
|||
helm.sh/chart: common-test-1.0.0
|
||||
test_label: test
|
||||
|
||||
- it: default configuration from folder with binary files should fail
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
configMapsFromFolder:
|
||||
enabled: true
|
||||
basePath: ci/configMapsFolder
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: "There was an error loading ConfigMap: test_2. If it was automatically generated from a folder verify that files are properly flagged as `binary` or `escaped`"
|
||||
|
||||
- it: default metadata from folder should pass
|
||||
set:
|
||||
configMaps:
|
||||
|
@ -129,15 +86,9 @@ tests:
|
|||
test_2.yaml:
|
||||
escaped: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- documentIndex: &FirstConfigmapDocument 0
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *FirstConfigmapDocument
|
||||
notExists:
|
||||
path: metadata.annotations
|
||||
- documentIndex: *FirstConfigmapDocument
|
||||
- documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].metadata.name
|
||||
value: release-name-config
|
||||
equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
|
@ -145,13 +96,9 @@ tests:
|
|||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: RELEASE-NAME
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
- documentIndex: &SecondConfigmapDocument 1
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *SecondConfigmapDocument
|
||||
notExists:
|
||||
path: metadata.annotations
|
||||
- documentIndex: *SecondConfigmapDocument
|
||||
- documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].metadata.name
|
||||
value: release-name-test_1
|
||||
equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
|
@ -159,13 +106,9 @@ tests:
|
|||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: RELEASE-NAME
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
- documentIndex: &ThirdConfigmapDocument 2
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *ThirdConfigmapDocument
|
||||
notExists:
|
||||
path: metadata.annotations
|
||||
- documentIndex: *ThirdConfigmapDocument
|
||||
- documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].metadata.name
|
||||
value: release-name-test_2
|
||||
equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
|
@ -187,20 +130,15 @@ tests:
|
|||
test_2:
|
||||
labels:
|
||||
test: test_label
|
||||
annotations:
|
||||
test: test_annotation
|
||||
fileAttributeOverrides:
|
||||
helm.jpg:
|
||||
binary: true
|
||||
test_2.yaml:
|
||||
escaped: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- documentIndex: &FirstConfigmapDocument 0
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *FirstConfigmapDocument
|
||||
- documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].metadata.name
|
||||
value: release-name-config
|
||||
equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
|
@ -208,10 +146,9 @@ tests:
|
|||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: RELEASE-NAME
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
- documentIndex: &SecondConfigmapDocument 1
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *SecondConfigmapDocument
|
||||
- documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].metadata.name
|
||||
value: release-name-test_1
|
||||
equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
|
@ -219,10 +156,9 @@ tests:
|
|||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: RELEASE-NAME
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
- documentIndex: &ThirdConfigmapDocument 2
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *ThirdConfigmapDocument
|
||||
- documentSelector:
|
||||
path: $[?(@.kind == "ConfigMap")].metadata.name
|
||||
value: release-name-test_2
|
||||
equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
|
@ -231,8 +167,3 @@ tests:
|
|||
app.kubernetes.io/name: RELEASE-NAME
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
test: test_label
|
||||
- documentIndex: *ThirdConfigmapDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
test: test_annotation
|
|
@ -0,0 +1,183 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: configmap - metadata - name
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
set:
|
||||
configMaps.main:
|
||||
data:
|
||||
test: test
|
||||
tests:
|
||||
- it: name defaults to chart fullName
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: release-name
|
||||
any: true
|
||||
|
||||
- it: forceRename
|
||||
set:
|
||||
configMaps.main.forceRename: forceRename
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: forcerename
|
||||
any: true
|
||||
|
||||
- it: forceRename with template
|
||||
set:
|
||||
configMaps.main.forceRename: "{{ .Chart.Name }}"
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: common-test
|
||||
any: true
|
||||
|
||||
- it: prefix
|
||||
set:
|
||||
configMaps.main.prefix: prefix
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: prefix-release-name
|
||||
any: true
|
||||
|
||||
- it: prefix with template
|
||||
set:
|
||||
configMaps.main.prefix: "{{ .Chart.Name }}"
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: common-test-release-name
|
||||
any: true
|
||||
|
||||
- it: suffix
|
||||
set:
|
||||
configMaps.main.suffix: suffix
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: release-name-suffix
|
||||
any: true
|
||||
|
||||
- it: suffix with template
|
||||
set:
|
||||
configMaps.main.suffix: "{{ .Chart.Name }}"
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: release-name-common-test
|
||||
any: true
|
||||
|
||||
- it: both prefix and suffix
|
||||
set:
|
||||
configMaps.main.prefix: prefix
|
||||
configMaps.main.suffix: suffix
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: prefix-release-name-suffix
|
||||
any: true
|
||||
|
||||
- it: prefix, suffix and forceRename (illegal combination)
|
||||
set:
|
||||
configMaps.main.forceRename: forceRename
|
||||
configMaps.main.prefix: prefix
|
||||
configMaps.main.suffix: suffix
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorPattern: "values don't meet the specifications of the schema"
|
||||
|
||||
- it: multiple items
|
||||
set:
|
||||
configMaps.second:
|
||||
data:
|
||||
test: test
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: release-name-main
|
||||
any: true
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: release-name-second
|
||||
any: true
|
||||
|
||||
- it: multiple items with prefix
|
||||
set:
|
||||
configMaps.second:
|
||||
prefix: prefix
|
||||
data:
|
||||
test: test
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: release-name-main
|
||||
any: true
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: prefix-release-name-second
|
||||
any: true
|
||||
|
||||
- it: multiple items with suffix
|
||||
set:
|
||||
configMaps.second:
|
||||
suffix: suffix
|
||||
data:
|
||||
test: test
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: release-name-main
|
||||
any: true
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: release-name-second-suffix
|
||||
any: true
|
||||
|
||||
- it: multiple items with prefix and suffix
|
||||
set:
|
||||
configMaps.second:
|
||||
prefix: prefix
|
||||
suffix: suffix
|
||||
data:
|
||||
test: test
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: release-name-main
|
||||
any: true
|
||||
- containsDocument:
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
name: prefix-release-name-second-suffix
|
||||
any: true
|
||||
|
||||
- it: multiple items with prefix, suffix and forceRename (illegal combination)
|
||||
set:
|
||||
configMaps.second:
|
||||
forceRename: forceRename
|
||||
prefix: prefix
|
||||
suffix: suffix
|
||||
data:
|
||||
test: test
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorPattern: "values don't meet the specifications of the schema"
|
|
@ -1,196 +0,0 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: configMap names
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
|
||||
- it: with disabled configMap should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
enabled: false
|
||||
data:
|
||||
test: test
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
|
||||
- it: with multiple configMap should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
foo: bar
|
||||
secondary:
|
||||
data:
|
||||
test: test
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &FirstConfigmapDocument 0
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *FirstConfigmapDocument
|
||||
isNotNullOrEmpty:
|
||||
path: metadata.name
|
||||
- documentIndex: &SecondConfigmapDocument 1
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *SecondConfigmapDocument
|
||||
isNotNullOrEmpty:
|
||||
path: metadata.name
|
||||
|
||||
- it: default name should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &ConfigmapDocument 0
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *ConfigmapDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-config
|
||||
|
||||
- it: with nameOverride should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
nameOverride: http
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &ConfigmapDocument 0
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *ConfigmapDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-http
|
||||
|
||||
- it: with templated nameOverride should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
nameOverride: "{{ .Release.Name }}"
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &ConfigmapDocument 0
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *ConfigmapDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME
|
||||
|
||||
- it: with templated nameOverride and from folder should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
nameOverride: "{{ .Release.Name }}"
|
||||
configMapsFromFolder:
|
||||
enabled: true
|
||||
basePath: ci/configMapsFolder
|
||||
configMapsOverrides:
|
||||
test_2:
|
||||
fileAttributeOverrides:
|
||||
helm.jpg:
|
||||
binary: true
|
||||
test_2.yaml:
|
||||
escaped: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- documentIndex: &FirstConfigmapDocument 0
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *FirstConfigmapDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME
|
||||
- documentIndex: &SecondConfigmapDocument 1
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *SecondConfigmapDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-test_1
|
||||
- documentIndex: &ThirdConfigmapDocument 2
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *ThirdConfigmapDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-test_2
|
||||
|
||||
- it: with templated nameOverride and from folder with forceRename should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
nameOverride: "{{ .Release.Name }}"
|
||||
configMapsFromFolder:
|
||||
enabled: true
|
||||
basePath: ci/configMapsFolder
|
||||
configMapsOverrides:
|
||||
test_1:
|
||||
forceRename: &newName1 newName1
|
||||
test_2:
|
||||
forceRename: &newName2 newName2
|
||||
fileAttributeOverrides:
|
||||
helm.jpg:
|
||||
binary: true
|
||||
test_2.yaml:
|
||||
escaped: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 4
|
||||
- documentIndex: &FirstConfigmapDocument 0
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *FirstConfigmapDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME
|
||||
- documentIndex: &SecondConfigmapDocument 1
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *SecondConfigmapDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: *newName1
|
||||
- documentIndex: &ThirdConfigmapDocument 2
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: *ThirdConfigmapDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: *newName2
|
|
@ -1,73 +0,0 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: configmap Pod metadata
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
enabled: true
|
||||
data:
|
||||
test: value 1
|
||||
test_default_enabled:
|
||||
data:
|
||||
test: value 1
|
||||
test_not_in_checksum:
|
||||
includeInChecksum: false
|
||||
data:
|
||||
test: value 1
|
||||
test_disabled:
|
||||
enabled: false
|
||||
data:
|
||||
test: value 1
|
||||
asserts:
|
||||
- documentIndex: &ControllerDoc 3
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *ControllerDoc
|
||||
equal:
|
||||
path: spec.template.metadata.annotations
|
||||
value:
|
||||
checksum/configMaps: 66d23d7a53c4e2a523ba85a969696b4ebb78ec5d79ab9c12c210c1569f48511b
|
||||
|
||||
- it: default metadata from folder should pass
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
enabled: true
|
||||
data:
|
||||
test: value 1
|
||||
test_default_enabled:
|
||||
data:
|
||||
test: value 1
|
||||
test_not_in_checksum:
|
||||
includeInChecksum: false
|
||||
data:
|
||||
test: value 1
|
||||
test_disabled:
|
||||
enabled: false
|
||||
data:
|
||||
test: value 1
|
||||
configMapsFromFolder:
|
||||
enabled: true
|
||||
basePath: ci/configMapsFolder
|
||||
configMapsOverrides:
|
||||
test_2:
|
||||
fileAttributeOverrides:
|
||||
helm.jpg:
|
||||
binary: true
|
||||
test_2.yaml:
|
||||
escaped: true
|
||||
asserts:
|
||||
- documentIndex: &ControllerDoc 5
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *ControllerDoc
|
||||
equal:
|
||||
path: spec.template.metadata.annotations
|
||||
value:
|
||||
checksum/configMaps: e83a24569d0b4f2ccc44aec36d4e9a1c44a29bcc92eefdffe14fb1ce81dff054
|
|
@ -0,0 +1,85 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: configmap - presence
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: configMap should not be rendered by default
|
||||
asserts:
|
||||
- not: true
|
||||
containsDocument:
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
name: release-name
|
||||
any: true
|
||||
|
||||
- it: with disabled configMap
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
enabled: false
|
||||
data:
|
||||
test: test
|
||||
asserts:
|
||||
- not: true
|
||||
containsDocument:
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
name: release-name
|
||||
any: true
|
||||
|
||||
- it: with multiple configMaps
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
foo: bar
|
||||
secondary:
|
||||
data:
|
||||
test: test
|
||||
asserts:
|
||||
- containsDocument:
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
name: release-name-config
|
||||
any: true
|
||||
- containsDocument:
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
name: release-name-secondary
|
||||
any: true
|
||||
|
||||
- it: combined with configMapsFromFolder
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
configMapsFromFolder:
|
||||
enabled: true
|
||||
basePath: ci/configMapsFolder
|
||||
configMapsOverrides:
|
||||
test_2:
|
||||
fileAttributeOverrides:
|
||||
helm.jpg:
|
||||
binary: true
|
||||
test_2.yaml:
|
||||
escaped: true
|
||||
asserts:
|
||||
- containsDocument:
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
name: release-name-config
|
||||
any: true
|
||||
- containsDocument:
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
name: release-name-test_1
|
||||
any: true
|
||||
- containsDocument:
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
name: release-name-test_2
|
||||
any: true
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: configmap - validations
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: default configuration from folder with binary files should fail
|
||||
set:
|
||||
configMaps:
|
||||
config:
|
||||
data:
|
||||
test: test
|
||||
configMapsFromFolder:
|
||||
enabled: true
|
||||
basePath: ci/configMapsFolder
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: "There was an error loading ConfigMap: test_2. If it was automatically generated from a folder verify that files are properly flagged as `binary` or `escaped`"
|
Loading…
Add table
Add a link
Reference in a new issue