185 lines
5.3 KiB
YAML
185 lines
5.3 KiB
YAML
suite: ingress metadata test
|
|
templates:
|
|
- common.yaml
|
|
chart:
|
|
appVersion: &appVer v9.9.9
|
|
release:
|
|
name: test-release-name
|
|
namespace: test-release-namespace
|
|
tests:
|
|
- it: should pass with ingress 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 }}"
|
|
service: &service
|
|
my-service:
|
|
enabled: true
|
|
primary: true
|
|
ports:
|
|
main:
|
|
enabled: true
|
|
primary: true
|
|
port: 80
|
|
ingress:
|
|
my-ingress1:
|
|
enabled: true
|
|
primary: true
|
|
labels:
|
|
label1: "{{ .Values.label1 }}"
|
|
label2: label2
|
|
annotations:
|
|
annotation1: "{{ .Values.annotation1 }}"
|
|
annotation2: annotation2
|
|
annotationsList:
|
|
- name: some-annotation
|
|
value: some-value
|
|
labelsList:
|
|
- name: some-label
|
|
value: some-value
|
|
integrations: &integrations
|
|
traefik:
|
|
enabled: false
|
|
hosts: &hosts
|
|
- host: test-host
|
|
paths:
|
|
- path: /test-path
|
|
my-ingress2:
|
|
enabled: true
|
|
primary: false
|
|
integrations: *integrations
|
|
hosts: *hosts
|
|
asserts:
|
|
- documentIndex: &ingressDoc 1
|
|
isKind:
|
|
of: Ingress
|
|
- documentIndex: *ingressDoc
|
|
isSubset:
|
|
path: metadata.annotations
|
|
content:
|
|
annotation1: annotation1
|
|
annotation2: annotation2
|
|
g_annotation1: global_annotation1
|
|
g_annotation2: global_annotation2
|
|
some-annotation: some-value
|
|
- documentIndex: *ingressDoc
|
|
matchRegex:
|
|
path: metadata.annotations.checksum/secrets
|
|
pattern: ^[0-9a-f]{64}$
|
|
- documentIndex: *ingressDoc
|
|
matchRegex:
|
|
path: metadata.annotations.checksum/services
|
|
pattern: ^[0-9a-f]{64}$
|
|
- documentIndex: *ingressDoc
|
|
equal:
|
|
path: metadata.labels
|
|
value:
|
|
app: common-test-1.0.0
|
|
release: test-release-name
|
|
helm-revision: "0"
|
|
helm.sh/chart: common-test-1.0.0
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/version: *appVer
|
|
app.kubernetes.io/instance: test-release-name
|
|
app.kubernetes.io/name: common-test
|
|
g_label1: global_label1
|
|
g_label2: global_label2
|
|
label1: label1
|
|
label2: label2
|
|
some-label: some-value
|
|
- documentIndex: *ingressDoc
|
|
equal:
|
|
path: metadata.name
|
|
value: test-release-name-common-test
|
|
- documentIndex: *ingressDoc
|
|
equal:
|
|
path: metadata.namespace
|
|
value: test-release-namespace
|
|
- documentIndex: &otherIngressDoc 2
|
|
isKind:
|
|
of: Ingress
|
|
- documentIndex: *otherIngressDoc
|
|
equal:
|
|
path: metadata.labels
|
|
value:
|
|
app: common-test-1.0.0
|
|
app.kubernetes.io/instance: test-release-name
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/name: common-test
|
|
app.kubernetes.io/version: *appVer
|
|
g_label1: global_label1
|
|
g_label2: global_label2
|
|
helm-revision: "0"
|
|
helm.sh/chart: common-test-1.0.0
|
|
release: test-release-name
|
|
- documentIndex: *otherIngressDoc
|
|
equal:
|
|
path: metadata.name
|
|
value: test-release-name-common-test-my-ingress2
|
|
- documentIndex: *otherIngressDoc
|
|
equal:
|
|
path: metadata.namespace
|
|
value: test-release-namespace
|
|
|
|
- it: should pass with ingress created with object namespace from tpl
|
|
set:
|
|
key: some-namespace
|
|
service: *service
|
|
ingress:
|
|
my-ingress1:
|
|
enabled: true
|
|
primary: true
|
|
namespace: "{{ .Values.key }}"
|
|
integrations: *integrations
|
|
hosts: *hosts
|
|
asserts:
|
|
- documentIndex: *ingressDoc
|
|
equal:
|
|
path: metadata.namespace
|
|
value: some-namespace
|
|
|
|
- it: should pass with ingress created with global namespace from tpl
|
|
set:
|
|
key: global-namespace
|
|
global:
|
|
namespace: "{{ .Values.key }}"
|
|
service: *service
|
|
ingress:
|
|
my-ingress1:
|
|
enabled: true
|
|
primary: true
|
|
integrations: *integrations
|
|
hosts: *hosts
|
|
asserts:
|
|
- documentIndex: *ingressDoc
|
|
equal:
|
|
path: metadata.namespace
|
|
value: global-namespace
|
|
|
|
- it: should pass with ingress created with root namespace from tpl
|
|
set:
|
|
key: local-namespace
|
|
namespace: "{{ .Values.key }}"
|
|
global:
|
|
namespace: global-namespace
|
|
service: *service
|
|
ingress:
|
|
my-ingress1:
|
|
enabled: true
|
|
primary: true
|
|
integrations: *integrations
|
|
hosts: *hosts
|
|
asserts:
|
|
- documentIndex: *ingressDoc
|
|
equal:
|
|
path: metadata.namespace
|
|
value: local-namespace
|