From be092babcff2b9258ff7bb6a7e52467812599f98 Mon Sep 17 00:00:00 2001 From: OZG-Cloud Team <noreply@ozg-sh.de> Date: Tue, 19 Dec 2023 12:32:16 +0100 Subject: [PATCH] OZG-3880 network policy dynamic dns server config --- run_helm_test.sh | 4 ++-- .../helm-linter-values.yaml} | 5 ++++- src/test/helm/network_policy_test.yaml | 16 +++++++++++++++- src/test/unit-values.yaml | 3 --- 4 files changed, 21 insertions(+), 7 deletions(-) rename src/{main/helm/test-values.yaml => test/helm-linter-values.yaml} (92%) diff --git a/run_helm_test.sh b/run_helm_test.sh index 7324e7d1..5c2ac8a3 100755 --- a/run_helm_test.sh +++ b/run_helm_test.sh @@ -2,6 +2,6 @@ set -e -helm template ./src/main/helm/ -f src/test/unit-values.yaml -helm lint -f src/test/unit-values.yaml ./src/main/helm/ +helm template ./src/main/helm/ -f src/test/helm-linter-values.yaml +helm lint -f src/test/helm-linter-values.yaml ./src/main/helm/ cd src/main/helm && helm unittest --helm3 -f '../../test/helm/*.yaml' -v '../../test/unit-values.yaml' . \ No newline at end of file diff --git a/src/main/helm/test-values.yaml b/src/test/helm-linter-values.yaml similarity index 92% rename from src/main/helm/test-values.yaml rename to src/test/helm-linter-values.yaml index e72f46c8..dc7bf7d6 100644 --- a/src/main/helm/test-values.yaml +++ b/src/test/helm-linter-values.yaml @@ -25,4 +25,7 @@ ozgcloud: environment: test bezeichner: helm - bundesland: sh \ No newline at end of file + bundesland: sh + +networkPolicy: + dnsServerNamespace: test-dns-server-namespace \ No newline at end of file diff --git a/src/test/helm/network_policy_test.yaml b/src/test/helm/network_policy_test.yaml index 901131fb..15c3a1ad 100644 --- a/src/test/helm/network_policy_test.yaml +++ b/src/test/helm/network_policy_test.yaml @@ -30,14 +30,23 @@ templates: - templates/network_policy.yaml 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 @@ -45,6 +54,9 @@ tests: name: network-policy-afm-adapter namespace: by-helm-test - it: validate spec + set: + networkPolicy: + dnsServerNamespace: test-dns-namespace asserts: - equal: path: spec @@ -69,7 +81,7 @@ tests: - to: - namespaceSelector: matchLabels: - kubernetes.io/metadata.name: dummy-dns-namespace + kubernetes.io/metadata.name: test-dns-namespace ports: - port: 53 protocol: UDP @@ -80,6 +92,7 @@ tests: set: networkPolicy: disabled: true + dnsServerNamespace: test-dns-namespace asserts: - hasDocuments: count: 0 @@ -88,6 +101,7 @@ tests: set: networkPolicy: disabled: false + dnsServerNamespace: test-dns-namespace asserts: - hasDocuments: count: 1 \ No newline at end of file diff --git a/src/test/unit-values.yaml b/src/test/unit-values.yaml index a49dcb02..90383c89 100644 --- a/src/test/unit-values.yaml +++ b/src/test/unit-values.yaml @@ -42,6 +42,3 @@ imageCredentials: username: ozgcloud password: <geheim> email: webmaster@ozg-sh.de - -networkPolicy: - dnsServerNamespace: dummy-dns-namespace \ No newline at end of file -- GitLab