ProcessHarness: HTTP health polling #3

Closed
opened 2026-04-11 10:55:37 +00:00 by charles · 0 comments
Owner

User story

As a test author, I want the harness to block until my app responds 200 on its health endpoint, so that no test runs against a half-started process and flakes from race conditions.

Acceptance criteria

  • After spawning, ProcessHarness::start() polls health_url via reqwest GET at health_poll_interval (default 100 ms).
  • A 2xx status marks the process ready and resolves start() with Ok(()).
  • If startup_timeout elapses without success:
    • The harness kills the child.
    • Returns TestError::Connection whose message contains:
      • The URL polled
      • The last HTTP status or transport error seen
      • The last 50 lines of stderr captured from the child
  • If the child exits before becoming ready, the poll loop short-circuits and reports the exit code along with stderr (no waiting out the full timeout).
  • Health polling honours cancellation: if the harness is dropped mid-poll, no tasks leak.
  • Polling uses a single reusable reqwest::Client (not one per request).
  • Connection errors during polling are silently retried until the timeout (they're expected during startup).

Out of scope

  • Configurable success status range — defaults to 2xx for now.
  • gRPC or custom protocol health checks.

References

  • Spec §1.2 (Health wait), §5.1 (Startup sequence)
## User story As a **test author**, I want the harness to block until my app responds 200 on its health endpoint, so that no test runs against a half-started process and flakes from race conditions. ## Acceptance criteria - [ ] After spawning, `ProcessHarness::start()` polls `health_url` via reqwest GET at `health_poll_interval` (default 100 ms). - [ ] A 2xx status marks the process ready and resolves `start()` with `Ok(())`. - [ ] If `startup_timeout` elapses without success: - The harness kills the child. - Returns `TestError::Connection` whose message contains: - The URL polled - The last HTTP status or transport error seen - The last 50 lines of stderr captured from the child - [ ] If the child exits before becoming ready, the poll loop short-circuits and reports the exit code along with stderr (no waiting out the full timeout). - [ ] Health polling honours cancellation: if the harness is dropped mid-poll, no tasks leak. - [ ] Polling uses a single reusable `reqwest::Client` (not one per request). - [ ] Connection errors during polling are silently retried until the timeout (they're expected during startup). ## Out of scope - Configurable success status range — defaults to 2xx for now. - gRPC or custom protocol health checks. ## References - Spec §1.2 (Health wait), §5.1 (Startup sequence)
charles added this to the v0.1.0 milestone 2026-04-11 10:55:37 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/ws-rpc-test#3
No description provided.