helm-charts/charts/library/common-test/tests/secret/metadata_test.yaml
2024-03-08 08:51:40 +01:00

116 lines
3 KiB
YAML

---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: secret metadata
templates:
- common.yaml
tests:
- it: default metadata should pass
set:
secrets:
secret:
stringData:
test: test
asserts:
- hasDocuments:
count: 2
- documentIndex: &SecretDocument 1
isKind:
of: Secret
- documentIndex: *SecretDocument
notExists:
path: metadata.annotations
- documentIndex: *SecretDocument
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:
secrets:
secret:
stringData:
test: test
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- hasDocuments:
count: 2
- documentIndex: &SecretDocument 1
isKind:
of: Secret
- documentIndex: *SecretDocument
equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *SecretDocument
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
secrets:
secret:
stringData:
test: test
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- hasDocuments:
count: 2
- documentIndex: &SecretDocument 1
isKind:
of: Secret
- documentIndex: *SecretDocument
equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- documentIndex: *SecretDocument
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 secret type should pass
set:
secrets:
secret:
stringData:
test: test
type: &type kubernetes.io/service-account-token
asserts:
- hasDocuments:
count: 2
- documentIndex: &SecretDocument 1
isKind:
of: Secret
- documentIndex: *SecretDocument
equal:
path: type
value: *type