Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions examples/sending emails/test.hurl
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
9 changes: 9 additions & 0 deletions examples/telemetry/test.hurl
Original file line number Diff line number Diff line change
Expand Up @@ -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\""
Expand Down
19 changes: 10 additions & 9 deletions examples/web servers - apache/test.hurl
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -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"
2 changes: 1 addition & 1 deletion scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 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.
27 changes: 24 additions & 3 deletions scripts/test-examples-hurl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 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 \
--retry-interval 1s \
--connect-timeout 2s \
--error-format long \
--from-entry 1 \
--to-entry 1 \
Comment on lines +65 to +66

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Probe SQLPage before running the email suite

In the checked hurl CI job, the sending emails suite's first entry only sends a DELETE to Mailpit on port 8025, so this entry-limited readiness run can succeed while SQLPage on port 8080 is still starting. Compose explicitly does not wait for containers to become ready, and the subsequent full-suite invocation has no global retry, leaving its immediate SQLPage GET vulnerable to a startup-race failure. Make the first probe target SQLPage (moving the idempotent cleanup afterward), or retain a request-level retry for that GET.

Useful? React with 👍 / 👎.

"$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
Expand Down
Loading