mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-03 08:37:03 +02:00
Signed-off-by: Gavin Mogan <git@gavinmogan.com> Co-authored-by: Gavin Mogan <git@gavinmogan.com> Co-authored-by: repo-duster[bot] <87358111+repo-duster[bot]@users.noreply.github.com>
115 lines
3.4 KiB
YAML
115 lines
3.4 KiB
YAML
---
|
|
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
|
suite: ingress metadata
|
|
templates:
|
|
- common.yaml
|
|
values:
|
|
- ../_values/ingress_main_default_hosts.yaml
|
|
- ../_values/controllers_main_default_container.yaml
|
|
tests:
|
|
- it: default metadata should pass
|
|
asserts:
|
|
- documentIndex: &IngressDocument 1
|
|
isKind:
|
|
of: Ingress
|
|
- documentIndex: *IngressDocument
|
|
notExists:
|
|
path: metadata.annotations
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: metadata.labels
|
|
value:
|
|
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 metadata should pass
|
|
set:
|
|
ingress.main:
|
|
annotations:
|
|
test_annotation: test
|
|
labels:
|
|
test_label: test
|
|
asserts:
|
|
- documentIndex: &IngressDocument 1
|
|
isKind:
|
|
of: Ingress
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: metadata.annotations
|
|
value:
|
|
test_annotation: test
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: metadata.labels
|
|
value:
|
|
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 metadata with global metadata should pass
|
|
set:
|
|
global:
|
|
labels:
|
|
global_label: test
|
|
annotations:
|
|
global_annotation: test
|
|
ingress.main:
|
|
annotations:
|
|
test_annotation: test
|
|
labels:
|
|
test_label: test
|
|
asserts:
|
|
- documentIndex: &IngressDocument 1
|
|
isKind:
|
|
of: Ingress
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: metadata.annotations
|
|
value:
|
|
global_annotation: test
|
|
test_annotation: test
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: metadata.labels
|
|
value:
|
|
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
|
|
|
|
|
|
- it: custom metadata with templates should pass
|
|
set:
|
|
ingress.main:
|
|
annotations:
|
|
template_annotation1: "{{ .Release.Name | lower }}"
|
|
template_annotation2: "{{ .Chart.Name | lower }}"
|
|
labels:
|
|
template_label1: "{{ .Release.Name | lower }}"
|
|
template_label2: "{{ .Chart.Name | lower }}"
|
|
asserts:
|
|
- documentIndex: &IngressDocument 1
|
|
isKind:
|
|
of: Ingress
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: metadata.annotations["template_annotation1"]
|
|
value: release-name
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: metadata.annotations["template_annotation2"]
|
|
value: common-test
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: metadata.labels["template_label1"]
|
|
value: release-name
|
|
- documentIndex: *IngressDocument
|
|
equal:
|
|
path: metadata.labels["template_label2"]
|
|
value: common-test
|