From ab237e6ef90d695934c094549fe08bf6e4eebf0a Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Tue, 30 Apr 2024 10:25:42 +0300 Subject: [PATCH] chore(traefik): add test for lookup --- .github/workflows/common_library_tests.yaml | 2 +- .../tests/ingress/traefik_test.yaml | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/.github/workflows/common_library_tests.yaml b/.github/workflows/common_library_tests.yaml index 535f94c9..64edebea 100644 --- a/.github/workflows/common_library_tests.yaml +++ b/.github/workflows/common_library_tests.yaml @@ -56,7 +56,7 @@ jobs: name: Unit Tests runs-on: ubuntu-22.04 env: - helmUnitVersion: 0.4.2 + helmUnitVersion: 0.5.0 strategy: fail-fast: false matrix: diff --git a/library/common-test/tests/ingress/traefik_test.yaml b/library/common-test/tests/ingress/traefik_test.yaml index ca655aba..0f778c6b 100644 --- a/library/common-test/tests/ingress/traefik_test.yaml +++ b/library/common-test/tests/ingress/traefik_test.yaml @@ -6,6 +6,20 @@ chart: release: name: test-release-name namespace: test-release-namespace +kubernetesProvider: + scheme: + "traefik.io/v1alpha1/Middleware": + namespaced: true + gvr: + group: "traefik.io" + version: "v1alpha1" + resource: "middlewares" + objects: + - kind: Middleware + apiVersion: traefik.io/v1alpha1 + metadata: + name: my-test-middleware + namespace: other-test-release-namespace tests: - it: should pass with ingress created with annotations from traefik set: @@ -441,6 +455,41 @@ tests: traefik.ingress.kubernetes.io/router.entrypoints: web traefik.ingress.kubernetes.io/router.middlewares: test-release-namespace-chain-basic@kubernetescrd + - it: should pass when a middleware does not have a namespace but exists as an object (can be looked up) + set: + service: *service + global: *global + ingress: + my-ingress1: + enabled: true + primary: true + integrations: + traefik: + enabled: true + entrypoints: + - websecure + middlewares: + - name: my-test-middleware + hosts: *hosts + asserts: + - documentIndex: *ingressDoc + isKind: + of: Ingress + - documentIndex: *ingressDoc + isKind: + of: Ingress + - documentIndex: *ingressDoc + equal: + path: metadata.name + value: test-release-name-common-test + - documentIndex: *ingressDoc + isSubset: + path: metadata.annotations + content: + traefik.ingress.kubernetes.io/router.tls: "true" + traefik.ingress.kubernetes.io/router.entrypoints: websecure + traefik.ingress.kubernetes.io/router.middlewares: test-release-namespace-chain-basic@kubernetescrd,other-test-release-namespace-my-test-middleware@kubernetescrd + # Failures - it: should fail with entrypoint not a slice set: