From 529e925d6448e485055d1d8a3188a1ee4c4f1063 Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Fri, 8 Dec 2023 13:22:17 +0200 Subject: [PATCH] actually add tets --- .../tests/chartContext/data_test.yaml | 324 ++++++++++++++++++ 1 file changed, 324 insertions(+) create mode 100644 library/common-test/tests/chartContext/data_test.yaml diff --git a/library/common-test/tests/chartContext/data_test.yaml b/library/common-test/tests/chartContext/data_test.yaml new file mode 100644 index 00000000..b3e5e917 --- /dev/null +++ b/library/common-test/tests/chartContext/data_test.yaml @@ -0,0 +1,324 @@ +suite: chart context data test +templates: + - common.yaml +release: + name: test-release-name + namespace: test-release-namespace +tests: + - it: should pass with service default values + set: + enabled: true + port: 12345 + service: + my-service: + enabled: "{{ .Values.enabled }}" + primary: true + ports: + my-port: + enabled: "{{ .Values.enabled }}" + primary: true + port: "{{ .Values.port }}" + asserts: + - documentIndex: &configMapDoc 0 + isKind: + of: ConfigMap + - documentIndex: *configMapDoc + equal: + path: metadata.name + value: test-release-name-common-test-chart-context + - documentIndex: *configMapDoc + equal: + path: data + value: + podCIDR: 172.16.0.0/16 + svcCIDR: 172.17.0.0/16 + appUrl: http://127.0.0.1:12345 + appHost: "127.0.0.1" + appPort: "12345" + appPath: / + appProtocol: http + + - it: should pass with service loadBalancer values + set: + ip: 1.2.3.4 + service: + my-service: + enabled: true + primary: true + type: LoadBalancer + loadBalancerIP: "{{ .Values.ip }}" + ports: + my-port: + enabled: true + primary: true + port: 12345 + asserts: + - documentIndex: &configMapDoc 0 + isKind: + of: ConfigMap + - documentIndex: *configMapDoc + equal: + path: metadata.name + value: test-release-name-common-test-chart-context + - documentIndex: *configMapDoc + equal: + path: data + value: + podCIDR: 172.16.0.0/16 + svcCIDR: 172.17.0.0/16 + appUrl: http://1.2.3.4:12345 + appHost: "1.2.3.4" + appPort: "12345" + appPath: / + appProtocol: http + + - it: should pass with ingress + set: + enabled: true + host: example.com + path: /some-path + operator: + verify: + enabled: false + ingress: + my-ingress: + enabled: "{{ .Values.enabled }}" + primary: true + integrations: + traefik: + enabled: false + hosts: + - host: "{{ .Values.host }}" + paths: + - path: "{{ .Values.path }}" + service: + my-service: + enabled: true + primary: true + ports: + my-port: + enabled: true + primary: true + port: 12345 + asserts: + - documentIndex: &configMapDoc 0 + isKind: + of: ConfigMap + - documentIndex: *configMapDoc + equal: + path: metadata.name + value: test-release-name-common-test-chart-context + - documentIndex: *configMapDoc + equal: + path: data + value: + podCIDR: 172.16.0.0/16 + svcCIDR: 172.17.0.0/16 + appUrl: https://example.com + appHost: "example.com" + appPort: "443" + appPath: /some-path + appProtocol: https + + - it: should pass with ingress and traefik integration + set: + operator: + verify: + enabled: false + ingress: + my-ingress: + enabled: true + primary: true + integrations: + traefik: + enabled: true + entrypoints: + - web + enableFixedMiddlewares: false + hosts: + - host: example.com + paths: + - path: /some-path + service: + my-service: + enabled: true + primary: true + ports: + my-port: + enabled: true + primary: true + port: 12345 + asserts: + - documentIndex: &configMapDoc 0 + isKind: + of: ConfigMap + - documentIndex: *configMapDoc + equal: + path: metadata.name + value: test-release-name-common-test-chart-context + - documentIndex: *configMapDoc + equal: + path: data + value: + podCIDR: 172.16.0.0/16 + svcCIDR: 172.17.0.0/16 + appUrl: http://example.com + appHost: "example.com" + appPort: "80" + appPath: /some-path + appProtocol: http + + - it: should pass with ingress and tls and traefik integration + set: + operator: + verify: + enabled: false + ingress: + my-ingress: + enabled: true + primary: true + integrations: + traefik: + enabled: true + entrypoints: + - web + enableFixedMiddlewares: false + hosts: + - host: example.com + paths: + - path: /some-path + tls: + - hosts: + - example.com + secretName: example-tls + service: + my-service: + enabled: true + primary: true + ports: + my-port: + enabled: true + primary: true + port: 12345 + asserts: + - documentIndex: &configMapDoc 0 + isKind: + of: ConfigMap + - documentIndex: *configMapDoc + equal: + path: metadata.name + value: test-release-name-common-test-chart-context + - documentIndex: *configMapDoc + equal: + path: data + value: + podCIDR: 172.16.0.0/16 + svcCIDR: 172.17.0.0/16 + appUrl: https://example.com + appHost: "example.com" + appPort: "443" + appPath: /some-path + appProtocol: https + + - it: should pass with ingress and tls and traefik integration + set: + operator: + verify: + enabled: false + ingress: + my-ingress: + enabled: true + primary: true + integrations: + traefik: + enabled: true + entrypoints: + - web + enableFixedMiddlewares: false + hosts: + - host: example.com + paths: + - path: /some-path + tls: + - hosts: + - example.com + secretName: example-tls + service: + my-service: + enabled: true + primary: true + ports: + my-port: + enabled: true + primary: true + port: 12345 + asserts: + - documentIndex: &configMapDoc 0 + isKind: + of: ConfigMap + - documentIndex: *configMapDoc + equal: + path: metadata.name + value: test-release-name-common-test-chart-context + - documentIndex: *configMapDoc + equal: + path: data + value: + podCIDR: 172.16.0.0/16 + svcCIDR: 172.17.0.0/16 + appUrl: https://example.com + appHost: "example.com" + appPort: "443" + appPath: /some-path + appProtocol: https + + - it: should pass with ingress and certManager integration and traefik integration + set: + operator: + verify: + enabled: false + ingress: + my-ingress: + enabled: true + primary: true + integrations: + certManager: + enabled: true + certificateIssuer: some-issuer + traefik: + enabled: true + entrypoints: + - web + enableFixedMiddlewares: false + hosts: + - host: example.com + paths: + - path: /some-path + service: + my-service: + enabled: true + primary: true + ports: + my-port: + enabled: true + primary: true + port: 12345 + asserts: + - documentIndex: &configMapDoc 0 + isKind: + of: ConfigMap + - documentIndex: *configMapDoc + equal: + path: metadata.name + value: test-release-name-common-test-chart-context + - documentIndex: *configMapDoc + equal: + path: data + value: + podCIDR: 172.16.0.0/16 + svcCIDR: 172.17.0.0/16 + appUrl: https://example.com + appHost: "example.com" + appPort: "443" + appPath: /some-path + appProtocol: https