Skip to content

Commit

Permalink
fix(perf): don't exit 1 after network benchmark (aquasecurity#4051)
Browse files Browse the repository at this point in the history
Script previously called the trapped cleanup procedure. That procedure
returned 1, since it was a trap routine in case of an error.
Split up the procedure into two, so that the trap routine returns 1
and the cleanup itself doesn't.
  • Loading branch information
NDStrahilevitz authored May 15, 2024
1 parent 62d70ce commit a83133e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions performance/benchmark/network/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ LOADGENERATOR_YAML="$SCRIPT_DIR/manifests/loadgenerator.yaml"
MICROSVCS_YAML="$SCRIPT_DIR/manifests/microservices.yaml"
TRACEE_YAML="$SCRIPT_DIR/../common/tracee.yaml"

CleanUp() {
Cleanup() {
kubectl delete \
-f $BENCHMARK_POLICY \
-f $LOADGENERATOR_YAML \
-f $MICROSVCS_YAML \
-f $TRACEE_YAML
}

CleanupOnError() {
Cleanup
exit 1
}

Expand All @@ -25,7 +29,7 @@ BENCHMARK_NAME="tracee_network_benchmark"

# add cleanup procedure

trap CleanUp SIGINT SIGTERM SIGTSTP ERR
trap CleanupOnError SIGINT SIGTERM SIGTSTP ERR

# setup benchmark

Expand Down Expand Up @@ -74,6 +78,7 @@ jq -n '{name: $bench_name, value: $bench_v, unit: "%"}' \
--arg bench_name $BENCHMARK_NAME \
--arg bench_v $overhead > bench_output.json

# call cleanup manually
# Cleanup

Cleanup

CleanUp

0 comments on commit a83133e

Please sign in to comment.