From 5670a89f2fe494e6c372182e09acaaae0f6f30f0 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Tue, 30 Apr 2024 12:31:09 +0300 Subject: [PATCH] chore(traefik): add test for lookup (#800) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [x] ⚖️ My code follows the style guidelines of this project - [x] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [x] ⚠️ My changes generate no new warnings - [x] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [ ] ⬆️ I increased versions for any altered app according to semantic versioning - [x] I made sure the title starts with `feat(chart-name):`, `fix(chart-name):` or `chore(chart-name):` **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --- .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: