From 3b9c604eb8cbceb81c2879b73c2d678f4ec2e20c Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 22 Apr 2026 09:45:51 +0530 Subject: [PATCH] Harden benchmark comparison run --- .github/workflows/ci.yml | 3 +++ tests/benchmarks/http.js | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e88feda47..a52f051fa7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/tests/benchmarks/http.js b/tests/benchmarks/http.js index 7762b5d8d6..e6b7db58ef 100644 --- a/tests/benchmarks/http.js +++ b/tests/benchmarks/http.js @@ -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) {