diff --git a/run_helm_test.sh b/run_helm_test.sh index 7324e7d118cdd0dd4d8815201c07089ea5122d12..5c2ac8a359d9b3be43e39c05eddf49e36d5f2a2d 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 e72f46c87bf4c6b6ce3cf960e19effcd09fd53b8..dc7bf7d67561d23925b5ebd3cbac9a491af1ffc8 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 901131fb06b622899f64d68dd33308c21bd7de00..15c3a1ad88d74d6f694f27a7698a81237f91fa1c 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 a49dcb0292ac28fa20348b9d613a173f13a435a9..90383c89a473e0b535d81be160f1d04ec46996d7 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