test(e2e): cover the hand-edited definition path - #1123
Merged
Conversation
The config directory is a documented, hand-editable surface, but the only coverage for an edit made there was manual: a definition file has no IPC call to assert against, and the sole evidence it applied is that the daemon's listeners changed. That needs a real daemon and a real socket. Two tests against a spawned daemon: a definition written into the config directory starts serving, pausing it releases the port, and resuming brings it back; and a file that does not parse leaves the running service untouched until a corrected one is saved. Neither lets a request reach a session, so neither needs a harness credential a CI runner does not have — an unauthenticated request is enough to prove the endpoint is up and is this service. Waits are polled against generous deadlines rather than slept, since the watcher's interval is an implementation detail. Verified by disabling the watcher: both tests fail.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
crates/config/services/*.tomlis a documented, hand-editable surface, and #1119 made edits there apply live. But that path had no automated coverage — I verified it by hand and said so in that PR.It resists unit testing by nature: a definition file has no IPC call to assert against, and the only evidence an edit applied is that the daemon's listeners changed. That needs a real daemon and a real socket, so it belongs in e2e.
What
Two tests against a spawned daemon:
a_definition_written_by_hand_starts_and_stops_serving— a definition appears in the config directory with no IPC call and no restart, and starts serving; editing it topaused = truereleases the port; resuming brings it back. Pausing is worth pinning specifically: before #1119 it did nothing at all, leaving the listener bound and answering.a_definition_that_does_not_parse_leaves_the_service_running— a file that cannot be parsed leaves the running service untouched (the operator's mistake costs them the edit, not the service), and a corrected file is picked up on a later pass, so a bad save is not a state the daemon must be restarted out of.Keeping it honest in CI
Verification
Disabling the watcher fails both tests, so they genuinely exercise the path rather than passing incidentally:
3/3 clean runs after restoring. Production code untouched — this PR adds one test file.