Skip to content

Add SIGTERM regression test for Hybrid fork interrupt handling#60

Merged
ioquatix merged 1 commit into
mainfrom
test/issue-58-sigterm-equivalence
May 31, 2026
Merged

Add SIGTERM regression test for Hybrid fork interrupt handling#60
ioquatix merged 1 commit into
mainfrom
test/issue-58-sigterm-equivalence

Conversation

@samuel-williams-shopify
Copy link
Copy Markdown
Contributor

Summary

Follow-up to #58 / #59.

SIGINT and SIGTERM are intentionally treated as equivalent in this library: both are trapped in each fork and converted into the same Interrupt exception (Forked::Child.fork):

Signal.trap(:INT){::Thread.current.raise(Interrupt)}
Signal.trap(:TERM){::Thread.current.raise(Interrupt)}  # Same as SIGINT.

The fix in #59 (Generic#interrupt sets @stopping = true) therefore covers a single SIGTERM to a Hybrid fork as well — it must drain the inner threads and exit, rather than respawning them forever (the inner container runs with restart: true, the default for async-service managed services).

This PR adds a regression test for the SIGTERM path so the equivalence is locked in and can't silently regress.

Changes

  • Refactors the existing single-SIGINT test into a shared helper.
  • Exercises both :INT and :TERM via the helper.

Verification

  • Both tests pass with the fix.
  • Both tests fail when @stopping = true is reverted in Generic#interrupt, confirming they are meaningful regression tests rather than false passes.
  • Full suite: 170/170 passing.

SIGINT and SIGTERM are intentionally equivalent: both are trapped in the
fork and converted into Interrupt (see Forked::Child.fork), so a single
signal of either kind must drain the inner threads and exit rather than
respawning them (issue #58).

Refactors the existing single-SIGINT test into a shared helper and
exercises both :INT and :TERM, locking in the documented equivalence.
@ioquatix ioquatix enabled auto-merge (rebase) May 31, 2026 22:55
@ioquatix ioquatix merged commit cb5a852 into main May 31, 2026
34 of 40 checks passed
@ioquatix ioquatix deleted the test/issue-58-sigterm-equivalence branch May 31, 2026 22:55
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.

2 participants