From 2277892fab975c73679836d695f4de3d7c6b7a0c Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Thu, 7 Dec 2023 17:13:21 +0200 Subject: [PATCH] add rules tests with targetSel --- .../common-test/tests/ingress/rules_test.yaml | 84 ++++++++++++++++++- 1 file changed, 80 insertions(+), 4 deletions(-) diff --git a/library/common-test/tests/ingress/rules_test.yaml b/library/common-test/tests/ingress/rules_test.yaml index 221c773c..eda68c2e 100644 --- a/library/common-test/tests/ingress/rules_test.yaml +++ b/library/common-test/tests/ingress/rules_test.yaml @@ -26,7 +26,7 @@ tests: enabled: true primary: true ingressClassName: some-class - hosts: &hosts + hosts: - host: test-host paths: - path: /test-path @@ -79,9 +79,7 @@ tests: overrideService: name: other-service port: 8080 - integrations: &integrations - traefik: - enabled: false + integrations: *integrations asserts: - documentIndex: &ingressDoc 1 isKind: @@ -121,3 +119,81 @@ tests: name: other-service port: number: 8080 + + - it: should pass with ingress created with rules with targetSelector + set: + operator: &operator + verify: + enabled: false + service: + my-service: + enabled: true + primary: true + ports: + main: + enabled: true + primary: true + port: 80 + my-service2: + enabled: true + ports: + my-port2: + enabled: true + port: 9000 + ingress: + my-ingress: + enabled: true + primary: true + targetSelector: + my-service2: my-port2 + hosts: &hosts + - host: test-host + paths: + - path: /test-path + - host: test-other-host + paths: + - path: /test-other-path + - path: /test-other-path2 + overrideService: + name: other-service + port: 8080 + integrations: *integrations + asserts: + - documentIndex: &ingressDoc 2 + isKind: + of: Ingress + - documentIndex: *ingressDoc + equal: + path: metadata.name + value: test-release-name-common-test + - documentIndex: *ingressDoc + equal: + path: spec.rules + value: + - host: test-host + http: + paths: + - path: /test-path + pathType: Prefix + backend: + service: + name: test-release-name-common-test-my-service2 + port: + number: 9000 + - host: test-other-host + http: + paths: + - path: /test-other-path + pathType: Prefix + backend: + service: + name: test-release-name-common-test-my-service2 + port: + number: 9000 + - path: /test-other-path2 + pathType: Prefix + backend: + service: + name: other-service + port: + number: 8080