Repository navigation
test(node): cover SIGHUP rejection of restart-required config fields (#499) - #572
Conversation
…499) Add an integration test that drives a real SIGHUP carrying both mutable (payment.rate_per_mb, observability.log_level) and restart-required (network/blockchain/cache/identity/gossip) changes, asserting the mutable ones apply while the restart-required ones are rejected with an info-level "ignoring change to X (requires restart)" notice. The existing reload unit tests poke the diff helpers directly and the other tests in this file only feed reloadable sections, so no test previously exercised the restart-required rejection arm against an OS signal -- the silent apply/drop regression #499 calls out. The test exercises all three branches of log_ignored_other_sections' section diff: reload #1 hits the absent->present no-baseline conservative-warn path ([network] vs empty baseline) and asserts absent sections stay silent; reload #2 keeps [network] byte-identical (the suppression branch must not re-warn) while newly-changed sections each emit exactly one notice, alongside mutable changes that must still apply. Assertions match the stable section prefix + "(requires restart)" suffix so cosmetic warn_ignored field-list edits don't break the test. Runs on a current_thread runtime with an inline-awaited reload and a thread-local buffer-capturing subscriber; tracing-subscriber is repeated as a dev-dependency since integration tests link only the public API + dev-deps. Module doc notes these tests require nextest's per-process isolation (tokio signal registration is process-global). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Adds an end-to-end integration test for the node’s SIGHUP hot-reload behavior to prevent regressions where restart-required config changes are silently applied or silently ignored, while ensuring mutable fields continue to hot-apply as expected.
Changes:
- Added a new
sighup_signalintegration test that performs two real SIGHUP→reload cycles and asserts (a) mutable fields apply and (b) restart-required section changes emit exactly-once “requires restart” info logs with correct suppression behavior. - Added log-capture infrastructure in the test (buffer writer +
tracing_subscriberdefault subscriber) to assert on reload-path tracing output. - Added
tracing-subscribertodecdn-nodedev-dependencies to support the new integration test.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/node/tests/sighup_signal.rs | Adds an integration test that validates mutable hot-reload + restart-required rejection (via captured tracing logs) across two reload cycles. |
| crates/node/Cargo.toml | Adds a dev-dependency needed by the new integration test to install a buffer-capturing tracing subscriber. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage reportTotal: 88.93% (was 88.90%, ▲ +0.03%) — 14596/16412 lines No coverage data for changed Rust files. History
|
There was a problem hiding this comment.
Code Review
This pull request enhances the SIGHUP signal integration tests by adding a new test case that verifies the correct handling of mutable versus restart-required configuration fields. It introduces a BufferWriter to capture tracing events and asserts that changes to restart-required sections are rejected with an informative log message while mutable fields are updated. Additionally, tracing-subscriber was added to the dev-dependencies to support log capturing in tests. I have no feedback to provide.
tracing-subscriber is already a normal [dependencies] entry of decdn-node. Integration tests have access to the package's normal dependencies (not only dev-dependencies, as the removed comment incorrectly claimed), so the duplicate dev-dependency was unnecessary and risked feature/version drift between the two entries. Verified by forced recompile of tests/sighup_signal.rs with the dev-dep removed: 3/3 tests still build and pass. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Closes #499. Adds an integration test verifying the SIGHUP config
hot-reload path applies mutable fields (
payment.rate_per_mb,observability.log_level) while rejecting restart-required fields(
network,blockchain,cache,identity,gossip) with aninfo-levelignoring change to X (requires restart)notice — never asilent apply or silent drop.
Before this, the reload unit tests only exercised the diff helpers
directly and the other
sighup_signal.rstests only fed reloadablesections, so nothing drove a real SIGHUP carrying both a mutable and a
restart-required change in one file — exactly the regression class #499
describes.
What the test covers
All three branches of
log_ignored_other_sections::changed, via tworeal SIGHUP→reload cycles on a
current_threadruntime:[network]against the emptystartup baseline: asserts the mutable change applies, the
absent→present no-baseline conservative-warn path emits exactly one
network notice, and absent
blockchain/cachestay silent.[network]+newly-changed
blockchain/cache/identity/gossip: assertsmutable changes still apply when bundled with restart-required ones,
the unchanged
[network]is suppressed (count stays 1), and eachnewly-changed section emits exactly one notice.
Assertions match the stable section prefix +
(requires restart)suffix, so cosmetic edits to
warn_ignored's field lists won't breakthe test while misclassification/suppression regressions still will.
Notes
fields are never applied to live runtime state), so the test installs
a buffer-capturing
tracing-subscriber. (tracing-subscriberisalready a normal
decdn-nodedependency and integration tests canuse it directly — an earlier revision added a redundant dev-dependency
that was removed after review.)
cargo nextest'sper-process isolation —
tokio::signal::unixregistration isprocess-global.
type design); the Critical finding (a previously-vacuous reload-Add devcontainer for secure Claude Code sessions #1
assertion) drove the three-branch restructure above.
Deferred follow-up
The
pinned_hashes-onlycache.*suppression negative case(
cache_changed_only_reloadable_fields) guards a logically distinctproperty — spurious cache warnings on pin/unpin, not restart-required
rejection — and is better as its own focused test than overloading this
one.
Verification
cargo nextest run -p decdn-node --test sighup_signal→ 3/3 passcargo clippy -p decdn-node --tests→ cleancargo fmt -- --check→ clean🤖 Generated with Claude Code