Files
chart/library/common-test/tests/service/metadata_test.yaml
Stavros Kois 929e60d801 NAS-121003 / 23.10 / Adapt charts CI and improve/fix common (#1011)
* Adapt charts CI and improve/fix common

* add check on permissions contaienr

* add postgres template

* update comments

* Update create_app.sh

* add check

* update script

* auto gen item.yaml from Chart,yaml

* rename readme on dest

* duplicate readme from the same source

* correct comment

* reoder

* remove extra space

* keep both README and app-readme

* update regex, to also allow 2 letter names, which is also valid

* No need to check host network if there aren't any pod values

* use same pattern as the pod.name label (not prepending release-name

* update deps

* add chart dirs to ci

* Add a validation to check if there is any yaml errors after merging files

* update charts path on ci

* common/1.0.0/ -> common/

* update common-test dep path

* temp update create_app script

* make permissions container name configurable, incase we want to change order of execution

* update naming convention

* fix typo and a missed name change

* do not allow `--` in names
2023-03-16 17:36:19 +02:00

159 lines
4.3 KiB
YAML

suite: service metadata test
templates:
- common.yaml
chart:
appVersion: &appVer v9.9.9
tests:
- it: should pass with service 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:
my-service1:
enabled: true
primary: true
labels:
label1: "{{ .Values.label1 }}"
label2: label2
annotations:
annotation1: "{{ .Values.annotation1 }}"
annotation2: annotation2
ports:
port-name:
enabled: true
primary: true
port: 12345
my-service2:
enabled: true
primary: false
ports:
port-name:
enabled: true
primary: true
port: 1234
workload:
my-workload:
enabled: true
primary: true
type: Deployment
podSpec: {}
asserts:
- documentIndex: &serviceDoc 1
isKind:
of: Service
- documentIndex: *serviceDoc
equal:
path: metadata.annotations
value:
annotation1: annotation1
annotation2: annotation2
g_annotation1: global_annotation1
g_annotation2: global_annotation2
- documentIndex: *serviceDoc
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/managed-by: Helm
app.kubernetes.io/version: *appVer
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: common-test
service.name: my-service1
g_label1: global_label1
g_label2: global_label2
label1: label1
label2: label2
- documentIndex: &otherServiceDoc 2
isKind:
of: Service
- documentIndex: *otherServiceDoc
equal:
path: metadata.labels
value:
service.name: my-service2
app: common-test-1.0.0
app.kubernetes.io/instance: 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: RELEASE-NAME
- it: should pass with correct selector with targetSelector
set:
service:
my-service1:
enabled: true
primary: true
targetSelector: my-workload
ports:
port-name:
enabled: true
primary: true
port: 12345
workload:
my-workload:
enabled: true
primary: true
type: Deployment
podSpec: {}
asserts:
- documentIndex: *serviceDoc
isKind:
of: Service
- documentIndex: *serviceDoc
equal:
path: spec.selector
value:
pod.name: my-workload
app.kubernetes.io/name: common-test
app.kubernetes.io/instance: RELEASE-NAME
- it: should pass with correct selector without targetSelector
set:
service:
my-service1:
enabled: true
primary: true
ports:
port-name:
enabled: true
primary: true
port: 12345
workload:
my-workload:
enabled: true
primary: true
type: Deployment
podSpec: {}
my-workload2:
enabled: true
type: Deployment
podSpec: {}
asserts:
- documentIndex: &serviceDoc 2
isKind:
of: Service
- documentIndex: *serviceDoc
equal:
path: spec.selector
value:
pod.name: my-workload
app.kubernetes.io/name: common-test
app.kubernetes.io/instance: RELEASE-NAME