From 8b17e368105396e95194f4952ff784bb346fc296 Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Fri, 12 Apr 2024 16:09:20 +0200
Subject: [PATCH] OZG-5100 cleanup tests

---
 .../src/test/helm/network_policy_test.yaml    | 39 +++++------------
 src/test/helm/network_policy_test.yaml        | 43 ++++++++++---------
 2 files changed, 32 insertions(+), 50 deletions(-)

diff --git a/nachrichten-bayernid-proxy/src/test/helm/network_policy_test.yaml b/nachrichten-bayernid-proxy/src/test/helm/network_policy_test.yaml
index fbb9de636..6942329e6 100644
--- a/nachrichten-bayernid-proxy/src/test/helm/network_policy_test.yaml
+++ b/nachrichten-bayernid-proxy/src/test/helm/network_policy_test.yaml
@@ -91,16 +91,15 @@ tests:
                 - port: 5353
                   protocol: TCP
 
-  - it: add ingress rule by values
+  - it: should add additionalIngressConfig
     set:
       networkPolicy:
-        ssoPublicIp: 51.89.117.53/32
-        dnsServerNamespace: test-namespace-dns
+        dnsServerNamespace: test-dns-namespace
         additionalIngressConfig:
         - from:
           - podSelector: 
               matchLabels:
-                component: client2
+                additionalIngressConfig: yes
     asserts:
       - contains:
           path: spec.ingress
@@ -108,49 +107,31 @@ tests:
             from:
             - podSelector: 
                 matchLabels:
-                  component: client2
-
+                  additionalIngressConfig: yes
 
-  - it: add egress rules by values
+  - it: should add additionalEgressConfig
     set:
-      networkPolicy:
+      networkPolicy: 
+        dnsServerNamespace: test-dns-namespace
         additionalEgressConfig:
-        - to:
-          - ipBlock:
-              cidr: 1.2.3.4/32
         - to:
           - podSelector:
               matchLabels:
-                component: ozg-testservice
-          ports:
-            - port: 12345
-              protocol: TCP
-
-        dnsServerNamespace: test-dns-namespace
+                additionalEgressConfig: yes
     asserts:
-    - contains:
-        path: spec.egress
-        content:
-          to:
-          - ipBlock:
-              cidr: 1.2.3.4/32
     - contains:
         path: spec.egress
         content:
           to:
           - podSelector:
               matchLabels:
-                component: ozg-testservice
-          ports:
-            - port: 12345
-              protocol: TCP
+                additionalEgressConfig: yes
 
 
   - it: should add additionalIngressConfigNamespace
     set:
       networkPolicy:
-        ssoPublicIp: 51.89.117.53/32
-        dnsServerNamespace: test-namespace-dns
+        dnsServerNamespace: test-dns-namespace
         additionalIngressConfigNamespace:
         - from:
           - podSelector: 
diff --git a/src/test/helm/network_policy_test.yaml b/src/test/helm/network_policy_test.yaml
index e31527a6a..ac7df6574 100644
--- a/src/test/helm/network_policy_test.yaml
+++ b/src/test/helm/network_policy_test.yaml
@@ -253,45 +253,46 @@ tests:
                 matchLabels:
                   component: client2
 
-  - it: add egress rules by values
+  - it: should add additionalIngressConfig
     set:
       networkPolicy:
+        dnsServerNamespace: test-namespace-dns
+        additionalIngressConfig:
+        - from:
+          - podSelector: 
+              matchLabels:
+                additionalIngressConfig: yes
+    asserts:
+      - contains:
+          path: spec.ingress
+          content:
+            from:
+            - podSelector: 
+                matchLabels:
+                  additionalIngressConfig: yes
+
+  - it: should add additionalEgressConfig
+    set:
+      networkPolicy:
+        dnsServerNamespace: test-namespace-dns
         additionalEgressConfig:
-        - to:
-          - ipBlock:
-              cidr: 1.2.3.4/32
         - to:
           - podSelector:
               matchLabels:
-                component: ozg-testservice
-          ports:
-            - port: 12345
-              protocol: TCP
-
-        dnsServerNamespace: test-dns-namespace
+                additionalEgressConfig: yes
     asserts:
-    - contains:
-        path: spec.egress
-        content:
-          to:
-          - ipBlock:
-              cidr: 1.2.3.4/32
     - contains:
         path: spec.egress
         content:
           to:
           - podSelector:
               matchLabels:
-                component: ozg-testservice
-          ports:
-            - port: 12345
-              protocol: TCP
+                additionalEgressConfig: yes
 
 
   - it: should add additionalIngressConfigNamespace
     set:
       networkPolicy:
-        ssoPublicIp: 51.89.117.53/32
         dnsServerNamespace: test-namespace-dns
         additionalIngressConfigNamespace:
         - from:
-- 
GitLab