Skip to content

Commit

Permalink
skip running vap tests for policies with variables when K8s version i…
Browse files Browse the repository at this point in the history
…s 1.27 or 1.26

Signed-off-by: Chandan-DK <chandan.dk@nirmata.com>
  • Loading branch information
Chandan-DK committed Aug 24, 2024
1 parent 7f05483 commit 2d79945
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
15 changes: 14 additions & 1 deletion .github/actions/run-tests/action.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: "Runs E2E Tests"
description: "Runs E2E tests using chainsaw"
inputs:
k8s-version:
description: "Kubernetes version"
required: false
tests:
description: "Test regex"
required: true
Expand All @@ -16,4 +19,14 @@ runs:
shell: bash
run: |
set -e
chainsaw test --config .chainsaw.yaml --include-test-regex '^chainsaw$/${{ matrix.tests }}' --test-file='${{ inputs.test-file }}' --no-color=false
K8S_VERSION="${{ inputs.k8s-version }}"
TEST_FILE="${{ inputs.test-file }}"
TESTS="${{ inputs.tests }}"
if [[ "$TEST_FILE" == "chainsaw-test-vap" && -n "$K8S_VERSION" ]] &&
[[ "$K8S_VERSION" == "v1.26."* || "$K8S_VERSION" == "v1.27."* ]]; then
chainsaw test --config .chainsaw.yaml --include-test-regex '^chainsaw$/${{ inputs.tests }}' --test-file='${{ inputs.test-file }}' --no-color=false --selector='!skipForVapAlpha'
else
chainsaw test --config .chainsaw.yaml --include-test-regex '^chainsaw$/${{ inputs.tests }}' --test-file='${{ inputs.test-file }}' --no-color=false
fi
4 changes: 3 additions & 1 deletion .github/workflows/cel-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ jobs:
with:
tests: ${{ matrix.tests }}
test-file: chainsaw-test-vap
k8s-version: ${{ matrix.k8s-version.version }}

validatingadmissionpolicies-tests-above-1-28:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -130,4 +131,5 @@ jobs:
uses: ./.github/actions/run-tests
with:
tests: ${{ matrix.tests }}
test-file: chainsaw-test-vap
test-file: chainsaw-test-vap
k8s-version: ${{ matrix.k8s-version.version }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ kind: Test
metadata:
creationTimestamp: null
name: disallow-host-process
labels:
skipForVapAlpha: ""
spec:
# disable templating because it can cause issues with CEL expressions
template: false
Expand Down

0 comments on commit 2d79945

Please sign in to comment.