Skip to content

nginx test script#80

Draft
rennergade wants to merge 1 commit intomainfrom
nginx-tests
Draft

nginx test script#80
rennergade wants to merge 1 commit intomainfrom
nginx-tests

Conversation

@rennergade
Copy link
Contributor

I put together this nginx test script since it doesn't seem like nginx is packaged with an easy way to test.

nginx/test_nginx.sh — Self-contained test runner with 9 test cases:

  1. GET index page — verifies HTTP 200 and "Welcome to nginx" in body
  2. HEAD request — verifies 200 and Content-Length header presence
  3. 404 error page — fetches nonexistent path, expects 404
  4. Static file serving — creates a temp file in html/, fetches it, verifies content
  5. Content-Length validation — compares header value to actual body size
  6. POST method — sends POST, accepts 200 or 405 (just verifies no crash)
  7. Multiple sequential requests — 10 requests in a loop, all must return 200
  8. Keepalive connection reuse — two requests via curl, checks for connection reuse
  9. Concurrent requests — 5 parallel curls, all must return 200

Key features:

  • Auto-discovers nginx binary (cwasm > opt.wasm > wasm) and Lind runtime (lind-wasm > lind-boot > lind_run)
  • Configurable port via $TEST_PORT (default 8080) and startup timeout via $STARTUP_TIMEOUT
  • Generates a temp nginx.conf and working directory, cleaned up via trap on exit
  • Polls with curl until nginx is ready (or times out with error + log dump)
  • Reports [PASS]/[FAIL] per test with a summary, exits 0 on all pass, 1 on any failure

Makefile — Added test-nginx target (depends on nginx build):
make test-nginx

@rennergade rennergade marked this pull request as draft February 20, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants