From 36e75f0d67355ca16b64a793773b589c51d68ac3 Mon Sep 17 00:00:00 2001 From: OZG-Cloud Team <noreply@ozg-sh.de> Date: Mon, 15 Jul 2024 17:49:43 +0200 Subject: [PATCH] OZG-6105 add netpol required values unittests xta-adapter --- .../src/test/helm/network_policy_test.yaml | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/xta-adapter/src/test/helm/network_policy_test.yaml b/xta-adapter/src/test/helm/network_policy_test.yaml index 0c21953e..74ac2858 100644 --- a/xta-adapter/src/test/helm/network_policy_test.yaml +++ b/xta-adapter/src/test/helm/network_policy_test.yaml @@ -27,19 +27,26 @@ release: namespace: by-helm-test templates: - templates/network_policy.yaml -set: - networkPolicy: - dnsServerNamespace: test-dns-namespace + tests: - it: should match apiVersion + set: + networkPolicy: + dnsServerNamespace: test-dns-namespace asserts: - isAPIVersion: of: networking.k8s.io/v1 - it: should match kind + set: + networkPolicy: + dnsServerNamespace: test-dns-namespace asserts: - isKind: of: NetworkPolicy - it: validate metadata + set: + networkPolicy: + dnsServerNamespace: test-dns-namespace asserts: - equal: path: metadata @@ -47,6 +54,9 @@ tests: name: network-policy-xta-adapter namespace: by-helm-test - it: validate spec + set: + networkPolicy: + dnsServerNamespace: test-dns-namespace asserts: - equal: path: spec @@ -135,6 +145,21 @@ tests: networkPolicy: disabled: false dnsServerNamespace: test-dns-namespace + asserts: + - hasDocuments: + count: 1 + - it: test network policy dnsServerNamespace must be set message + set: + networkPolicy: + disabled: false + asserts: + - failedTemplate: + errorMessage: networkPolicy.dnsServerNamespace must be set + + - it: test network policy should be enabled by default + set: + networkPolicy: + dnsServerNamespace: test-dns-server-namespace asserts: - hasDocuments: count: 1 \ No newline at end of file -- GitLab