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,51 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: rawResource - metadata - annotations
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
set:
|
||||
rawResources:
|
||||
config:
|
||||
apiVersion: v1
|
||||
kind: Endpoint
|
||||
spec:
|
||||
test: test
|
||||
tests:
|
||||
- it: no annotations are set by default
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "Endpoint")].metadata.name
|
||||
value: release-name
|
||||
asserts:
|
||||
- notExists:
|
||||
path: metadata.annotations
|
||||
|
||||
- it: custom annotations
|
||||
set:
|
||||
rawResources.config.annotations:
|
||||
test_annotation: test
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "Endpoint")].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
|
||||
rawResources.config.annotations:
|
||||
test_annotation: test
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "Endpoint")].metadata.name
|
||||
value: release-name
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
global_annotation: test
|
||||
test_annotation: test
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: rawResource metadata
|
||||
suite: rawResource - metadata - labels
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
|
@ -13,13 +13,11 @@ set:
|
|||
spec:
|
||||
test: test
|
||||
tests:
|
||||
- it: default metadata should be present
|
||||
documentSelector: &EndpointSelector
|
||||
- it: default labels
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "Endpoint")].metadata.name
|
||||
value: RELEASE-NAME-config
|
||||
value: release-name
|
||||
asserts:
|
||||
- notExists:
|
||||
path: metadata.annotations
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
|
@ -28,20 +26,14 @@ tests:
|
|||
app.kubernetes.io/name: RELEASE-NAME
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
|
||||
- it: custom metadata can be configured
|
||||
- it: custom labels
|
||||
set:
|
||||
rawResources:
|
||||
config:
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
documentSelector: *EndpointSelector
|
||||
rawResources.config.labels:
|
||||
test_label: test
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "Endpoint")].metadata.name
|
||||
value: release-name
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
test_annotation: test
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
|
@ -51,26 +43,16 @@ tests:
|
|||
helm.sh/chart: common-test-1.0.0
|
||||
test_label: test
|
||||
|
||||
- it: global metadata can be configured with local overrides
|
||||
- it: custom labels mixed with global labels
|
||||
set:
|
||||
global:
|
||||
labels:
|
||||
global_label: test
|
||||
annotations:
|
||||
global_annotation: test
|
||||
rawResources:
|
||||
config:
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
documentSelector: *EndpointSelector
|
||||
global.labels:
|
||||
global_label: test
|
||||
rawResources.config.labels:
|
||||
test_label: test
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "Endpoint")].metadata.name
|
||||
value: release-name
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
global_annotation: test
|
||||
test_annotation: test
|
||||
- equal:
|
||||
path: metadata.labels
|
||||
value:
|
|
@ -0,0 +1,195 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: rawResource - metadata - name
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
set:
|
||||
rawResources.main:
|
||||
apiVersion: v1
|
||||
kind: Endpoint
|
||||
spec:
|
||||
test: test
|
||||
tests:
|
||||
- it: name defaults to chart fullName
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: release-name
|
||||
any: true
|
||||
|
||||
- it: forceRename
|
||||
set:
|
||||
rawResources.main.forceRename: forceRename
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: forcerename
|
||||
any: true
|
||||
|
||||
- it: forceRename with template
|
||||
set:
|
||||
rawResources.main.forceRename: "{{ .Chart.Name }}"
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: common-test
|
||||
any: true
|
||||
|
||||
- it: prefix
|
||||
set:
|
||||
rawResources.main.prefix: prefix
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: prefix-release-name
|
||||
any: true
|
||||
|
||||
- it: prefix with template
|
||||
set:
|
||||
rawResources.main.prefix: "{{ .Chart.Name }}"
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: common-test-release-name
|
||||
any: true
|
||||
|
||||
- it: suffix
|
||||
set:
|
||||
rawResources.main.suffix: suffix
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: release-name-suffix
|
||||
any: true
|
||||
|
||||
- it: suffix with template
|
||||
set:
|
||||
rawResources.main.suffix: "{{ .Chart.Name }}"
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: release-name-common-test
|
||||
any: true
|
||||
|
||||
- it: both prefix and suffix
|
||||
set:
|
||||
rawResources.main.prefix: prefix
|
||||
rawResources.main.suffix: suffix
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: prefix-release-name-suffix
|
||||
any: true
|
||||
|
||||
- it: prefix, suffix and forceRename (illegal combination)
|
||||
set:
|
||||
rawResources.main.forceRename: forceRename
|
||||
rawResources.main.prefix: prefix
|
||||
rawResources.main.suffix: suffix
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorPattern: "values don't meet the specifications of the schema"
|
||||
|
||||
- it: multiple items
|
||||
set:
|
||||
rawResources.second:
|
||||
apiVersion: v1
|
||||
kind: Endpoint
|
||||
spec:
|
||||
test: test
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: release-name-main
|
||||
any: true
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: release-name-second
|
||||
any: true
|
||||
|
||||
- it: multiple items with prefix
|
||||
set:
|
||||
rawResources.second:
|
||||
prefix: prefix
|
||||
apiVersion: v1
|
||||
kind: Endpoint
|
||||
spec:
|
||||
test: test
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: release-name-main
|
||||
any: true
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: prefix-release-name-second
|
||||
any: true
|
||||
|
||||
- it: multiple items with suffix
|
||||
set:
|
||||
rawResources.second:
|
||||
suffix: suffix
|
||||
apiVersion: v1
|
||||
kind: Endpoint
|
||||
spec:
|
||||
test: test
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: release-name-main
|
||||
any: true
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: release-name-second-suffix
|
||||
any: true
|
||||
|
||||
- it: multiple items with prefix and suffix
|
||||
set:
|
||||
rawResources.second:
|
||||
prefix: prefix
|
||||
suffix: suffix
|
||||
apiVersion: v1
|
||||
kind: Endpoint
|
||||
spec:
|
||||
test: test
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: release-name-main
|
||||
any: true
|
||||
- containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
name: prefix-release-name-second-suffix
|
||||
any: true
|
||||
|
||||
- it: multiple items with prefix, suffix and forceRename (illegal combination)
|
||||
set:
|
||||
rawResources.second:
|
||||
forceRename: forceRename
|
||||
prefix: prefix
|
||||
suffix: suffix
|
||||
apiVersion: v1
|
||||
kind: Endpoint
|
||||
spec:
|
||||
test: test
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorPattern: "values don't meet the specifications of the schema"
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: rawResource values
|
||||
suite: rawResource - presence
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
|
@ -19,38 +19,24 @@ set:
|
|||
port: 443
|
||||
protocol: TCP
|
||||
tests:
|
||||
- it: raw resources can be configured
|
||||
documentSelector: &EndpointSelector
|
||||
- it: raw resources are enabled by default
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "Endpoint")].metadata.name
|
||||
value: RELEASE-NAME-endpoint
|
||||
value: release-name
|
||||
asserts:
|
||||
- equal:
|
||||
path: subsets[0].addresses[0].ip
|
||||
value: 127.0.0.1
|
||||
|
||||
- it: nameOverride can be configured
|
||||
- it: raw resources can be disabled
|
||||
set:
|
||||
rawResources.endpoint:
|
||||
nameOverride: test
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "Endpoint")].metadata.name
|
||||
value: RELEASE-NAME-test
|
||||
rawResources.endpoint.enabled: false
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-test
|
||||
|
||||
- it: nameOverride with template should pass
|
||||
set:
|
||||
rawResources.endpoint:
|
||||
nameOverride: "{{ .Release.Name }}"
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "Endpoint")].metadata.name
|
||||
value: RELEASE-NAME
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME
|
||||
- not: true
|
||||
containsDocument:
|
||||
kind: Endpoint
|
||||
apiVersion: v1
|
||||
any: true
|
||||
|
||||
- it: spec can render Helm template
|
||||
set:
|
||||
|
@ -63,7 +49,9 @@ tests:
|
|||
- name: "{{ .Release.Name }}"
|
||||
port: 443
|
||||
protocol: TCP
|
||||
documentSelector: *EndpointSelector
|
||||
documentSelector:
|
||||
path: $[?(@.kind == "Endpoint")].metadata.name
|
||||
value: release-name
|
||||
asserts:
|
||||
- equal:
|
||||
path: subsets[0].ports[0].name
|
Loading…
Add table
Add a link
Reference in a new issue