Files
tailscale/cmd/testwrapper
Tom Proctor 8bcc919dcf cmd/testwrapper: ensure unfinished tests always trigger failure (#22622)
When packages timed out or panicked, we sometimes marked CI green
despite not running all the tests for that package, and the tests that
started but didn't finish got marked as flaky even though they were not
known to be at fault. For example, all 133 recorded flakes of
ipnlocal.TestNewExtensionHost were really an ipnlocal watchdog panic or
a package timeout on Windows, and 129 of those jobs passed.

Parse the test binary's terminal log line, and check for tests that
started but never finished. If either shows that the test binary didn't
complete, don't retry any of the package's tests, and fail the run. The
log line check also catches a panic in a test's own goroutine, which
the testing package reports as a normal test failure even though the
tests after it never start.

While here, fix some related problems:

- A package that fails with no failed test (e.g. TestMain exits
  non-zero) is now fatal even if another package in the same go test
  invocation has a failed test to retry. Previously the check counted
  the failed tests of the whole batch, not of the package.
- If a test passes on retry but go test still fails (e.g. TestMain
  exits non-zero after the tests run), fail the run. Previously we
  only logged the error and exited 0.
- A data race now drops only the retries of its own package, not of
  every package in the batch.
- If go test fails with nothing to retry, don't exit straight away;
  still retry other batches' failures and write the GitHub step
  summaries, then exit with go test's exit code. The results summary
  now shows unfinished tests as failed instead of passed.

Updates tailscale/corp#52113

Signed-off-by: Tom Proctor <[email protected]>
2026-11-24 18:33:45 +00:00
..