From 1c9c185cc48792c2f25b4cd9ec123ccf02fb1232 Mon Sep 17 00:00:00 2001 From: Dan Notestein Date: Sun, 30 Nov 2025 18:08:12 -0500 Subject: [PATCH 1/3] Re-enable API benchmark script in CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The api-benchmark-script was commented out in September 2024 during the Python-to-SQL migration (commit 63c553e0c). Now that the PostgREST migration is complete and all smoke tests have been re-enabled, the benchmark should also run again. This generates request_process_times.log which is needed by the benchmark-results-collector downstream job. Also adds the missing YAML anchor (&api-benchmark-script) to the script definition so it can be referenced. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .gitlab-ci.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yaml b/.gitlab-ci.yaml index ddad662514..82517497e9 100644 --- a/.gitlab-ci.yaml +++ b/.gitlab-ci.yaml @@ -238,7 +238,7 @@ variables: "auto" echo -e "\e[0Ksection_end:$(date +%s):tags_api_smoketest_negative\r\e[0K" -.api-benchmark-script: +.api-benchmark-script: &api-benchmark-script - | echo -e "\e[0Ksection_start:$(date +%s):api-benchmark[collapsed=true]\r\e[0KRunning API benchmark..." ./scripts/ci/start-api-benchmarks.sh \ @@ -661,8 +661,7 @@ e2e_benchmark_on_postgrest: BENCHMARK_AWAIT_URL="tcp://${RUNNER_HIVEMIND_BENCHMARK_SERVER_HOSTNAME}:${RUNNER_HIVEMIND_SERVER_HTTP_PORT}" echo "Waiting for Hivemind benchmark server to start running on ${BENCHMARK_AWAIT_URL}" "${DATA_CACHE_HIVEMIND}/await" -t 10m "${BENCHMARK_AWAIT_URL}" -- echo "Hivemind benchmark instance is running" - # TODO: Uncomment anchors to enable a test group. To test only selected methods, add their names to the environment variable - # - *api-benchmark-script + - *api-benchmark-script after_script: - | echo -e "\e[0Ksection_start:$(date +%s):logs[collapsed=true]\r\e[0KCollecting logs..." -- GitLab From f7fdef8500d58dfc901af6146a44d734515a4e3f Mon Sep 17 00:00:00 2001 From: Dan Notestein Date: Mon, 1 Dec 2025 19:32:22 -0500 Subject: [PATCH 2/3] CI: Skip csv-report-parser if benchmark.csv not found (PostgREST compatibility) --- scripts/ci/start-api-benchmarks.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/ci/start-api-benchmarks.sh b/scripts/ci/start-api-benchmarks.sh index 9dbfc471ed..d64fbfecaf 100755 --- a/scripts/ci/start-api-benchmarks.sh +++ b/scripts/ci/start-api-benchmarks.sh @@ -36,4 +36,15 @@ for ((i = 0; i < ITERATIONS; i++)); do "${@:5}" echo "Done!" done -tox -e csv-report-parser -- "http://${HIVEMIND_ADDRESS}" "${HIVEMIND_PORT}" "${TAVERN_DIR}" "${TAVERN_DIR}" --time-threshold=2.0 + +# The csv-report-parser requires benchmark.csv which is generated by server-side timing. +# PostgREST doesn't support server-side request time logging, so we skip the report +# generation if benchmark.csv doesn't exist. The benchmark tests still run and validate +# the API works correctly. +if [ -f "${TAVERN_DIR}/benchmark.csv" ]; then + tox -e csv-report-parser -- "http://${HIVEMIND_ADDRESS}" "${HIVEMIND_PORT}" "${TAVERN_DIR}" "${TAVERN_DIR}" --time-threshold=2.0 +else + echo "WARNING: benchmark.csv not found - skipping benchmark report generation." + echo "This is expected with PostgREST which doesn't support server-side request timing." + echo "Benchmark tests still ran and validated API functionality." +fi -- GitLab From 8f685f0945dc0a9bd5bc543a46a0fa83ccae3db1 Mon Sep 17 00:00:00 2001 From: Dan Notestein Date: Mon, 1 Dec 2025 20:35:22 -0500 Subject: [PATCH 3/3] CI: Fix benchmark script variable reference and reduce iterations - Fix $HIVEMIND_BENCHMARKS_IDS_FILE variable reference (was missing $) - Reduce default iterations from 5 to 1 to reduce CI time - Remove quotes from ${@:5} to handle empty extra args correctly --- scripts/ci/start-api-benchmarks.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/ci/start-api-benchmarks.sh b/scripts/ci/start-api-benchmarks.sh index d64fbfecaf..c091bdb63e 100755 --- a/scripts/ci/start-api-benchmarks.sh +++ b/scripts/ci/start-api-benchmarks.sh @@ -4,7 +4,8 @@ set -euo pipefail export HIVEMIND_ADDRESS="$1" export HIVEMIND_PORT="$2" -ITERATIONS=${3:-5} +# Use 1 iteration for now to reduce CI time; benchmark tests validate API functionality +ITERATIONS=${3:-1} JOBS=${4:-"auto"} TAVERN_DIR="$(realpath ./tests/api_tests/hivemind/tavern)" @@ -28,12 +29,12 @@ echo "Attempting to start benchmarks on hivemind instance listening on: ${HIVEMI for ((i = 0; i < ITERATIONS; i++)); do echo "About to run iteration ${i}" - rm -f HIVEMIND_BENCHMARKS_IDS_FILE + rm -f "$HIVEMIND_BENCHMARKS_IDS_FILE" tox -e tavern-benchmark -- \ -W ignore::pytest.PytestDeprecationWarning \ -n "${JOBS}" \ -m "not postgrest_exception" \ - "${@:5}" + ${@:5} echo "Done!" done -- GitLab