Skip to content

fix: harden integration timing and SIGTERM assertions#2847

Merged
markphelps merged 1 commit intomainfrom
integration-test-followups
Mar 18, 2026
Merged

fix: harden integration timing and SIGTERM assertions#2847
markphelps merged 1 commit intomainfrom
integration-test-followups

Conversation

@markphelps
Copy link
Copy Markdown
Contributor

Summary

  • replace fixed sleep in webhook_delivery_failure with health-check polling to reduce timing flake
  • tighten async_generator_precollect to assert predict_time reflects full generation duration
  • strengthen TestSIGTERMDuringSetup to assert termination is specifically caused by SIGTERM

Test Plan

  • Attempted: go test -tags integration ./integration-tests/concurrent -run TestSIGTERMDuringSetup -count=1
  • Blocked locally by environment permissions while building wheels (python/cog.egg-info and crates/target/release/.cargo-lock permission denied)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates integration tests to be less flaky and more precise about timing/health behavior during async operations and shutdown scenarios.

Changes:

  • Replace fixed sleep with repeated health-check polling in the webhook delivery failure test.
  • Tighten predict_time assertions for async generator pre-collection to require ~0.5s+ duration.
  • Add stricter SIGTERM exit verification in the concurrent integration test.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
integration-tests/tests/webhook_delivery_failure.txtar Polls /health-check repeatedly during webhook retry/failure window instead of sleeping.
integration-tests/tests/async_generator_precollect.txtar Updates predict_time regex to enforce minimum expected generation duration.
integration-tests/concurrent/concurrent_test.go Adds SIGTERM exit-type/signal assertions using errors.As + syscall.WaitStatus.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +505 to +520
if err == nil {
t.Fatal("server exited cleanly after SIGTERM; expected termination by signal")
}

var exitErr *exec.ExitError
if !errors.As(err, &exitErr) {
t.Fatalf("server exited with unexpected error type after SIGTERM: %T (%v)", err, err)
}

ws, ok := exitErr.Sys().(syscall.WaitStatus)
if !ok {
t.Fatalf("server exited after SIGTERM but wait status was unavailable: %v", err)
}
if !ws.Signaled() || ws.Signal() != syscall.SIGTERM {
t.Fatalf("server exit = %v, want signal %v", ws, syscall.SIGTERM)
}
Copy link
Copy Markdown
Member

@michaeldwan michaeldwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, though we should use testify assert/require helpers instead of t.Fatal etc

case err := <-done:
t.Logf("Server exited: %v", err)
if err == nil {
t.Fatal("server exited cleanly after SIGTERM; expected termination by signal")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testify assert/require can cut down a lot of this code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markphelps markphelps merged commit 6361ba9 into main Mar 18, 2026
35 checks passed
@markphelps markphelps deleted the integration-test-followups branch March 18, 2026 19:59
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.

3 participants