Skip to content

Commit

Permalink
Merge branch 'add_threshold' of https://github.com/kyverno/load-testing
Browse files Browse the repository at this point in the history
… into add_threshold
  • Loading branch information
realshuting committed Oct 27, 2023
2 parents 5174113 + 334dfea commit fe26f98
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 22 deletions.
49 changes: 28 additions & 21 deletions .github/workflows/load-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/[email protected]
# with:
# filename: k6/tests/kyverno-pss.js 10 100
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
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)

0 comments on commit fe26f98

Please sign in to comment.