Harden benchmark comparison run

This commit is contained in:
Chirag Aggarwal
2026-04-22 09:45:51 +05:30
parent 7c486ddcef
commit 3b9c604eb8
2 changed files with 16 additions and 4 deletions
+3
View File
@@ -714,12 +714,14 @@ jobs:
run: |
set -o pipefail
rm -f benchmark-before-summary.json benchmark-after-summary.json benchmark-before-samples.json benchmark-after-samples.json benchmark-before.txt benchmark.txt
# Use the current benchmark script for both images so before/after differ only by the Appwrite image.
docker run --rm -i --network host --user "$(id -u):$(id -g)" -v "$PWD:/scripts" -w /scripts ${{ env.K6_IMAGE }} run --quiet \
--out json=benchmark-before-samples.json \
-e APPWRITE_ENDPOINT=http://localhost/v1 \
-e APPWRITE_MAILDEV_ENDPOINT=http://localhost:9503/email \
-e APPWRITE_BENCHMARK_ITERATIONS=1 \
-e APPWRITE_BENCHMARK_VUS=1 \
-e APPWRITE_WORKER_TIMEOUT_MS=120000 \
-e APPWRITE_BENCHMARK_SUMMARY_PATH=benchmark-before-summary.json \
tests/benchmarks/http.js | tee benchmark-before.txt
@@ -748,6 +750,7 @@ jobs:
-e APPWRITE_MAILDEV_ENDPOINT=http://localhost:9503/email \
-e APPWRITE_BENCHMARK_ITERATIONS=1 \
-e APPWRITE_BENCHMARK_VUS=1 \
-e APPWRITE_WORKER_TIMEOUT_MS=120000 \
-e APPWRITE_BENCHMARK_PREVIOUS_SUMMARY_PATH=benchmark-before-summary.json \
-e APPWRITE_BENCHMARK_SUMMARY_PATH=benchmark-after-summary.json \
tests/benchmarks/http.js | tee benchmark.txt
+13 -4
View File
@@ -956,11 +956,20 @@ function detailRow(data, label, metric, unit = 'ms') {
}
function loadPreviousSummary() {
try {
return JSON.parse(open(PREVIOUS_SUMMARY_PATH));
} catch (error) {
return null;
const paths = [PREVIOUS_SUMMARY_PATH];
if (!PREVIOUS_SUMMARY_PATH.startsWith('/')) {
paths.push(`../../${PREVIOUS_SUMMARY_PATH}`);
}
for (const path of paths) {
try {
return JSON.parse(open(path));
} catch (error) {
// Try the next path. k6 resolves open() relative to the script file.
}
}
return null;
}
function comparisonTable(before, after) {