From b5af1b20b2e45e05babf65af4222c678eb3f07f3 Mon Sep 17 00:00:00 2001 From: Ophir LOJKINE Date: Wed, 7 Oct 2026 22:46:22 +0200 Subject: [PATCH 1/2] ci: scope Hurl retries to readiness --- examples/telemetry/test.hurl | 9 +++++++++ scripts/README.md | 2 +- scripts/test-examples-hurl.sh | 27 ++++++++++++++++++++++++--- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/examples/telemetry/test.hurl b/examples/telemetry/test.hurl index ae807c4ee..f03b69a1b 100644 --- a/examples/telemetry/test.hurl +++ b/examples/telemetry/test.hurl @@ -22,18 +22,27 @@ body contains "Hurl telemetry todo" body not contains "An error occurred" GET http://localhost:3200/api/search?q=%7Bresource.service.name%3D%22sqlpage%22%7D&limit=20 +[Options] +retry: 60 +retry-interval: 1s HTTP 200 [Asserts] body contains "sqlpage" body contains "\"traceID\":\"3\"" GET http://localhost:3200/api/search?q=%7Bresource.service.name%3D%22nginx%22%7D&limit=20 +[Options] +retry: 60 +retry-interval: 1s HTTP 200 [Asserts] body contains "nginx" body contains "\"traceID\":\"3\"" GET http://localhost:3200/api/traces/3 +[Options] +retry: 60 +retry-interval: 1s HTTP 200 [Asserts] body contains "\"service.name\"" diff --git a/scripts/README.md b/scripts/README.md index 38ec96d4b..b4f8bba4f 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -16,4 +16,4 @@ These scripts pass configuration between build stages through temporary files in - **`package-test-binaries.sh`**: Compiles the Rust test harnesses once and tars them, so the database matrix runs the same executables instead of recompiling SQLPage six times. - **`run-test-binaries.sh`**: Runs SQLPage compiled executables against whatever `DATABASE_URL` names. - **`install-oracle-odbc.sh`**: Verifies and extracts the pinned Oracle Instant Client 23ai ZIPs, registers a private ODBC driver, and writes its environment to `GITHUB_ENV`. CI caches the archives under `RUNNER_TEMP`. Requires curl, unzip, unixODBC, and libaio. -- **`test-examples-hurl.sh`**: Starts an example's containers and runs its `test.hurl` suite. Takes an example path to filter on. +- **`test-examples-hurl.sh`**: Starts an example's containers, retries only the first safe Hurl entry as a readiness check, then runs the suite without global retries. Takes an example path to filter on; telemetry trace lookups retain per-request retries for Tempo indexing. diff --git a/scripts/test-examples-hurl.sh b/scripts/test-examples-hurl.sh index 90c1f20f6..2626d8457 100755 --- a/scripts/test-examples-hurl.sh +++ b/scripts/test-examples-hurl.sh @@ -50,12 +50,33 @@ while IFS= read -r -d "" test_file; do echo "::endgroup::" exit 1 fi - if ! hurl --test \ + hurl_args=( + --test + --connect-timeout 2s + --error-format long + ) + + # Each suite starts with a safe GET, except the idempotent Mailpit cleanup + # DELETE in the email example. Retry only this readiness entry so a failure + # in a later POST is reported once instead of replaying the request. + if ! hurl "${hurl_args[@]}" \ --retry 60 \ --retry-interval 1s \ - --connect-timeout 2s \ - --error-format long \ + --from-entry 1 \ + --to-entry 1 \ "$test_file"; then + echo "::error file=$rel_dir/test.hurl,title=Example readiness check failed::$rel_dir did not become ready" + echo "::group::docker compose ps for $rel_dir" + docker compose -p "$current_project" -f "$current_compose" ps + echo "::endgroup::" + echo "::group::docker compose logs for $rel_dir" + docker compose -p "$current_project" -f "$current_compose" logs + echo "::endgroup::" + echo "::endgroup::" + exit 1 + fi + + if ! hurl "${hurl_args[@]}" "$test_file"; then echo "::error file=$rel_dir/test.hurl,title=Hurl example test failed::$rel_dir failed" echo "::group::docker compose ps for $rel_dir" docker compose -p "$current_project" -f "$current_compose" ps From 54ccecf0f5f5b8b62fd06b6b4280bb7915e7efa0 Mon Sep 17 00:00:00 2001 From: Ophir Lojkine Date: Thu, 8 Oct 2026 12:48:12 +0000 Subject: [PATCH 2/2] ci: probe SQLPage readiness in email and Apache suites --- examples/sending emails/test.hurl | 10 +++++++--- examples/web servers - apache/test.hurl | 19 ++++++++++--------- scripts/README.md | 2 +- scripts/test-examples-hurl.sh | 4 ++-- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/examples/sending emails/test.hurl b/examples/sending emails/test.hurl index 8e5ae06cb..ed92f5612 100644 --- a/examples/sending emails/test.hurl +++ b/examples/sending emails/test.hurl @@ -1,12 +1,16 @@ -DELETE http://127.0.0.1:8025/api/v1/messages -HTTP 200 - +# Probe SQLPage before clearing Mailpit or sending any messages. GET http://127.0.0.1:8080/ HTTP 200 [Asserts] xpath "string(//a[contains(., 'Simple email')]/@href)" == "simple.sql" xpath "string(//a[contains(., 'Advanced email')]/@href)" == "advanced.sql" +DELETE http://127.0.0.1:8025/api/v1/messages +[Options] +retry: 60 +retry-interval: 1s +HTTP 200 + GET http://127.0.0.1:8080/simple.sql HTTP 200 [Asserts] diff --git a/examples/web servers - apache/test.hurl b/examples/web servers - apache/test.hurl index 5029dc026..e8f871b2a 100644 --- a/examples/web servers - apache/test.hurl +++ b/examples/web servers - apache/test.hurl @@ -1,3 +1,13 @@ +# Probe SQLPage through Apache, including its database connection. +GET http://localhost:8080/my_website/ +HTTP 200 +[Asserts] +header "Content-Type" contains "text/html" +body contains "Welcome to my website" +body contains "Using SQLPage v" +body contains "Connected to" +body contains "MySQL" + GET http://localhost:8080/ HTTP 200 [Asserts] @@ -9,12 +19,3 @@ GET http://localhost:8080/my_website HTTP 301 [Asserts] header "Location" == "/my_website/" - -GET http://localhost:8080/my_website/ -HTTP 200 -[Asserts] -header "Content-Type" contains "text/html" -body contains "Welcome to my website" -body contains "Using SQLPage v" -body contains "Connected to" -body contains "MySQL" diff --git a/scripts/README.md b/scripts/README.md index b4f8bba4f..746964aa7 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -16,4 +16,4 @@ These scripts pass configuration between build stages through temporary files in - **`package-test-binaries.sh`**: Compiles the Rust test harnesses once and tars them, so the database matrix runs the same executables instead of recompiling SQLPage six times. - **`run-test-binaries.sh`**: Runs SQLPage compiled executables against whatever `DATABASE_URL` names. - **`install-oracle-odbc.sh`**: Verifies and extracts the pinned Oracle Instant Client 23ai ZIPs, registers a private ODBC driver, and writes its environment to `GITHUB_ENV`. CI caches the archives under `RUNNER_TEMP`. Requires curl, unzip, unixODBC, and libaio. -- **`test-examples-hurl.sh`**: Starts an example's containers, retries only the first safe Hurl entry as a readiness check, then runs the suite without global retries. Takes an example path to filter on; telemetry trace lookups retain per-request retries for Tempo indexing. +- **`test-examples-hurl.sh`**: Starts an example's containers, retries only the first safe GET served by SQLPage as a readiness check, then runs the suite without global retries. Takes an example path to filter on; Mailpit cleanup and telemetry trace lookups retain per-request retries for service readiness and Tempo indexing. diff --git a/scripts/test-examples-hurl.sh b/scripts/test-examples-hurl.sh index 2626d8457..b6e9432f7 100755 --- a/scripts/test-examples-hurl.sh +++ b/scripts/test-examples-hurl.sh @@ -56,8 +56,8 @@ while IFS= read -r -d "" test_file; do --error-format long ) - # Each suite starts with a safe GET, except the idempotent Mailpit cleanup - # DELETE in the email example. Retry only this readiness entry so a failure + # Each suite starts with a safe GET served by SQLPage, including through + # reverse proxies. Retry only this readiness entry so a failure # in a later POST is reported once instead of replaying the request. if ! hurl "${hurl_args[@]}" \ --retry 60 \