mirror of
https://github.com/truenas/charts.git
synced 2026-04-13 16:19:43 +08:00
151 lines
4.8 KiB
YAML
151 lines
4.8 KiB
YAML
suite: deployment metadata test
|
|
templates:
|
|
- common.yaml
|
|
chart:
|
|
appVersion: &appVer v9.9.9
|
|
tests:
|
|
- it: should pass with deployment created with labels and annotations
|
|
set:
|
|
label1: label1
|
|
label2: global_label2
|
|
annotation1: annotation1
|
|
annotation2: global_annotation2
|
|
global:
|
|
labels:
|
|
g_label1: global_label1
|
|
g_label2: "{{ .Values.label2 }}"
|
|
annotations:
|
|
g_annotation1: global_annotation1
|
|
g_annotation2: "{{ .Values.annotation2 }}"
|
|
workload:
|
|
workload-name:
|
|
enabled: true
|
|
primary: true
|
|
type: Deployment
|
|
labels:
|
|
label1: "{{ .Values.label1 }}"
|
|
label2: label2
|
|
annotations:
|
|
annotation1: "{{ .Values.annotation1 }}"
|
|
annotation2: annotation2
|
|
podSpec:
|
|
labels:
|
|
pod-label1: pod-label1
|
|
pod-label2: "{{ .Values.label2 }}"
|
|
annotations:
|
|
pod-annotation1: pod-annotation1
|
|
pod-annotation2: "{{ .Values.annotation2 }}"
|
|
asserts:
|
|
- documentIndex: &deploymentDoc 0
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *deploymentDoc
|
|
equal:
|
|
path: metadata.annotations
|
|
value:
|
|
annotation1: annotation1
|
|
annotation2: annotation2
|
|
g_annotation1: global_annotation1
|
|
g_annotation2: global_annotation2
|
|
- documentIndex: *deploymentDoc
|
|
equal:
|
|
path: metadata.labels
|
|
value:
|
|
app: common-test-1.0.0
|
|
release: RELEASE-NAME
|
|
helm-revision: "0"
|
|
helm.sh/chart: common-test-1.0.0
|
|
app.kubernetes.io/name: common-test
|
|
app.kubernetes.io/instance: RELEASE-NAME
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/version: *appVer
|
|
g_label1: global_label1
|
|
g_label2: global_label2
|
|
label1: label1
|
|
label2: label2
|
|
- documentIndex: *deploymentDoc
|
|
equal:
|
|
path: spec.selector.matchLabels
|
|
value:
|
|
pod.name: workload-name
|
|
app.kubernetes.io/name: common-test
|
|
app.kubernetes.io/instance: RELEASE-NAME
|
|
- documentIndex: *deploymentDoc
|
|
equal:
|
|
path: spec.template.metadata.labels
|
|
value:
|
|
pod.name: workload-name
|
|
app: common-test-1.0.0
|
|
release: RELEASE-NAME
|
|
app.kubernetes.io/instance: RELEASE-NAME
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/name: common-test
|
|
app.kubernetes.io/version: v9.9.9
|
|
helm-revision: "0"
|
|
helm.sh/chart: common-test-1.0.0
|
|
g_label1: global_label1
|
|
g_label2: global_label2
|
|
pod-label1: pod-label1
|
|
pod-label2: global_label2
|
|
- documentIndex: *deploymentDoc
|
|
matchRegex:
|
|
path: spec.template.metadata.annotations.rollme
|
|
pattern: '^[0-9a-zA-Z]{5}$'
|
|
|
|
- it: should pass with 2 deployment created with correct selector labels
|
|
set:
|
|
workload:
|
|
workload-name:
|
|
enabled: true
|
|
primary: true
|
|
type: Deployment
|
|
podSpec: {}
|
|
other-workload-name:
|
|
enabled: true
|
|
primary: false
|
|
type: Deployment
|
|
podSpec: {}
|
|
asserts:
|
|
- documentIndex: *deploymentDoc
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *deploymentDoc
|
|
equal:
|
|
path: metadata.name
|
|
value: release-name-common-test-other-workload-name
|
|
- documentIndex: *deploymentDoc
|
|
equal:
|
|
path: spec.selector.matchLabels
|
|
value:
|
|
pod.name: other-workload-name
|
|
app.kubernetes.io/name: common-test
|
|
app.kubernetes.io/instance: RELEASE-NAME
|
|
- documentIndex: *deploymentDoc
|
|
isSubset:
|
|
path: spec.template.metadata.labels
|
|
content:
|
|
pod.name: other-workload-name
|
|
app.kubernetes.io/instance: RELEASE-NAME
|
|
app.kubernetes.io/name: common-test
|
|
- documentIndex: &otherDeploymentDoc 1
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *otherDeploymentDoc
|
|
equal:
|
|
path: metadata.name
|
|
value: release-name-common-test
|
|
- documentIndex: *otherDeploymentDoc
|
|
equal:
|
|
path: spec.selector.matchLabels
|
|
value:
|
|
pod.name: workload-name
|
|
app.kubernetes.io/name: common-test
|
|
app.kubernetes.io/instance: RELEASE-NAME
|
|
- documentIndex: *otherDeploymentDoc
|
|
isSubset:
|
|
path: spec.template.metadata.labels
|
|
content:
|
|
pod.name: workload-name
|
|
app.kubernetes.io/instance: RELEASE-NAME
|
|
app.kubernetes.io/name: common-test
|