sww tests: wait for the starting line as long as the start takes (closes #324) #332

Merged
clawbot merged 1 commits from issue-324-start-wait into next 2026-11-11 06:31:03 +01:00
Collaborator

Fixes #324. Tests only, in internal/sww/sww_test.go.

A start compiles the Core Rule Set, so on a loaded host it can take longer than waitLimit (10 s) to write starting. The new output.lineBeforeExit waits for a line until it is written or sww exits. Nothing else ends the wait except the test binary's -timeout, which names the test that hangs. metricsWith and saveUntilAnswered in the same file already wait this way.

It replaces the waits that span the start:

  • runUntilStopped: starting;
  • TestServesUntilToldToStop: read the rule files and starting;
  • TestLogLevelHoldsBackTheLessSevereProcessLines: fetching a list failed, written after the start.

Waits left on waitLimit in this file, and why load cannot fail them:

  • output.line after sww has exited (the refused starts, and lines read from a runUntilStopped result): the output is complete.
  • output.line after a request sww has answered: the start is over.
  • The refused starts' context.WithTimeout(waitLimit): each refusal returns 1 whatever the context; the timeout only stops an sww that starts by mistake.
  • "still running after being told to stop": it times the stop, not the start, and a stop that hangs is what it catches.

The same 10-second wait for starting in waf_test.go, healthcheck_test.go and rproxy_test.go is #331.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/smallwebwaf/issues/324. Tests only, in `internal/sww/sww_test.go`. A start compiles the Core Rule Set, so on a loaded host it can take longer than `waitLimit` (10 s) to write `starting`. The new `output.lineBeforeExit` waits for a line until it is written or sww exits. Nothing else ends the wait except the test binary's `-timeout`, which names the test that hangs. `metricsWith` and `saveUntilAnswered` in the same file already wait this way. It replaces the waits that span the start: - `runUntilStopped`: `starting`; - `TestServesUntilToldToStop`: `read the rule files` and `starting`; - `TestLogLevelHoldsBackTheLessSevereProcessLines`: `fetching a list failed`, written after the start. Waits left on `waitLimit` in this file, and why load cannot fail them: - `output.line` after sww has exited (the refused starts, and lines read from a `runUntilStopped` result): the output is complete. - `output.line` after a request sww has answered: the start is over. - The refused starts' `context.WithTimeout(waitLimit)`: each refusal returns 1 whatever the context; the timeout only stops an sww that starts by mistake. - "still running after being told to stop": it times the stop, not the start, and a stop that hangs is what it catches. The same 10-second wait for `starting` in `waf_test.go`, `healthcheck_test.go` and `rproxy_test.go` is https://git.eeqj.de/sneak/smallwebwaf/issues/331. Model: opus-5-5
clawbot added the needs-review label 2026-11-11 05:58:26 +01:00
clawbot self-assigned this 2026-11-11 05:58:26 +01:00
clawbot added 1 commit 2026-11-11 05:58:26 +01:00
A start on a loaded host can take longer than the 10-second wait for
a line. The new output.lineBeforeExit waits until the line is written
or sww exits, so only the test binary's own timeout ends the wait. It
replaces the waits that span the start in runUntilStopped,
TestServesUntilToldToStop and TestLogLevelHoldsBackTheLessSevereProcessLines.

Model: opus-5-5
Author
Collaborator

PASS: the waits that span a start in internal/sww/sww_test.go now last until the line is written or sww exits, which meets the definition of done of #324.

Model: opus-5-5

PASS: the waits that span a start in `internal/sww/sww_test.go` now last until the line is written or sww exits, which meets the definition of done of https://git.eeqj.de/sneak/smallwebwaf/issues/324. Model: opus-5-5
clawbot merged commit b89c53c640 into next 2026-11-11 06:31:03 +01:00
clawbot deleted branch issue-324-start-wait 2026-11-11 06:31:04 +01:00
Sign in to join this conversation.