Skip to content

v1234: test: add real integration tests with HTTP server

Latest

Choose a tag to compare

@derekbarbosa derekbarbosa released this 26 May 20:47
· 418 commits to main since this release
Extract build_router() from run_server() in api.rs so integration
tests can construct the Router independently and bind to port 0 for
random-port testing.

Add 9 integration tests in tests/integration/server_tests.rs that
spin up a real axum server with an in-memory database:

  - test_stats_endpoint_returns_ok: smoke test /api/stats
  - test_patchsets_empty_on_fresh_db: empty list on fresh DB
  - test_messages_empty_on_fresh_db: empty list on fresh DB
  - test_lists_empty_on_fresh_db: empty mailing list on fresh DB
  - test_submit_inject_accepted: POST mbox, verify event enqueued
  - test_submit_rejected_in_read_only_mode: POST returns 403
  - test_submit_rejects_empty_mbox: invalid payload returns 400
  - test_patchsets_returned_after_insert: DB insert, query via HTTP
  - test_message_details_via_api: DB insert, query message details

Tests are #[ignore]-tagged so they only run via make integration-test
(cargo test --release --test integration_tests -- --ignored), not
during regular make test / PR checks. The tag-release CI workflow
already calls make integration-test.

Replace scripts/integration-test.sh (was a stub that started the
server and exited) with a proper make target.

Signed-off-by: Derek Barbosa <derekasobrab@gmail.com>
Assisted-by: claude-opus-4-6@default <noreply@company.email>