From 67cad270a2e491a732c224430cc3c31fa0026322 Mon Sep 17 00:00:00 2001 From: mrjoelkamp Date: Mon, 10 Jun 2024 13:54:21 -0500 Subject: [PATCH] fix: e2e namespace --- .github/workflows/workflow.yaml | 1 + test/bats/test.bats | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index bee3075..01c7d0e 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -122,4 +122,5 @@ jobs: - name: Run e2e run: | + export GATEKEEPER_NAMESPACE=security bats -t test/bats/test.bats diff --git a/test/bats/test.bats b/test/bats/test.bats index d5fb168..178adf3 100644 --- a/test/bats/test.bats +++ b/test/bats/test.bats @@ -8,7 +8,7 @@ GATEKEEPER_NAMESPACE=${GATEKEEPER_NAMESPACE:-gatekeeper-system} teardown_file() { kubectl delete -f validation/ - kubectl delete -f mutation/ + #kubectl delete -f mutation/ } @test "gatekeeper-controller-manager is running" { @@ -32,7 +32,8 @@ teardown_file() { assert_success wait_for_process ${WAIT_TIME} ${SLEEP_TIME} "constraint_enforced k8sattestexternaldata deny-images-that-fail-policy" - run kubectl run nginx --image=nginx --dry-run=server + run kubectl create ns test + run kubectl run nginx --image=nginx -n test --dry-run=server # should deny pod admission if the image doesn't pass policy assert_failure assert_match 'admit: false' "${output}"