diff --git a/.github/workflows/load-test.yaml b/.github/workflows/load-test.yaml index 634a056..eca1194 100644 --- a/.github/workflows/load-test.yaml +++ b/.github/workflows/load-test.yaml @@ -15,6 +15,21 @@ concurrency: jobs: run-load-test: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + vus: + - name: vu + values: + - 1000 + iterations: + - name: iteration + values: + - 1000 + scripts: + - name: script + values: + - kyverno-pss.js steps: - name: Checkout uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 @@ -26,28 +41,20 @@ jobs: - name: Run local k6 test shell: bash run: | - cd k6 - export VUS=10 - export ITERATIONS=1000 - export SCRIPT=kyverno-pss.js - ./start.sh tests/$SCRIPT $VUS $ITERATIONS - - grep "level=error" "$SCRIPT-${VUS}vu-${ITERATIONS}it-logs.txt" - # Store the exit code of the grep command - exit_code=$? + export VUS=${{ join(matrix.vus.values, ',') }} + export ITERATIONS=${{ join(matrix.iterations.values, ',') }} + export SCRIPT=${{ join(matrix.scripts.values, ',') }} + make kyverno-pss-block + cat ${SCRIPT}-${VUS}vu-${ITERATIONS}it-logs.txt + - name: Check errors: + shell: bash + run: | + make check-error + # - name: Debug + # if: failure() + # run: | + # cat kyverno-pss.js-10vu-1000it-logs.txt - # Check if the exit code is 0 (match found) or 1 (no match found) - if [ $exit_code -eq 0 ]; then - echo "Error found in the file." - exit 1 - elif [ $exit_code -eq 1 ]; then - echo "No error found in the file." - exit 0 - else - echo "An error occurred while searching the file." - exit 1 - fi - cat kyverno-pss.js-10vu-1000it-logs.txt # uses: grafana/k6-action@v0.3.0 # with: # filename: k6/tests/kyverno-pss.js 10 100 \ No newline at end of file diff --git a/Makefile b/Makefile index 934e5ca..49c11ba 100644 --- a/Makefile +++ b/Makefile @@ -50,4 +50,21 @@ kind-create-cluster: $(KIND) ## Create kind cluster @$(KIND) create cluster --name $(KIND_NAME) --image $(KIND_IMAGE) --config ./configs/kind/default.yaml .PHONY: kind-deploy-kyverno -kind-deploy-kyverno: helm-add-repo helm-install-kyverno ## Deploy kyverno helm chart \ No newline at end of file +kind-deploy-kyverno: helm-add-repo helm-install-kyverno ## Deploy kyverno helm chart + +###### +# K6 # +###### + +VUS ?= 10 +ITERATIONS ?= 1000 +SCRIPT ?= "kyverno-pss.js" + +.PHONY: kyverno-pss-block +kyverno-pss-block: + cd k6 \ + ./start.sh ./tests/${SCRIPT} ${VUS} ${ITERATIONS} + +.PHONY: check-error +check-error: + @grep -q "level=error" "${SCRIPT}-${VUS}vu-${ITERATIONS}it-logs.txt" || (echo "Error found in the file."; exit 1) \ No newline at end of file