Repository navigation
test: keep daemon status tests off a real biffd (PL-1871) - #709
Merged
Merged
Conversation
Contributor
PR Summary by Qodotest: keep daemon status tests off a real biffd's port
AI Description
Merge Risk
|
Contributor
Code Review by Qodo
View medium (1) 1.
|
Contributor
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.
Problem
On a machine running a real biffd on 127.0.0.1:8424,
TestDaemonStatus::test_not_installedgot exit 0 instead of 1, andtest_installed_but_not_answering_exits_1(record = port 1) still reported healthy.Cause
Not a product bug.
ServiceCommands.statusprobes the recorded port in the run directory first (so--portusers get the right answer), then falls back to the unit's port (BIFFD_SPEC.health_port, 8424) because a recorded port can be stale after a crash. With no record,RunDir.read_port()returns DEFAULT_PORT (8424). The testhomefixture only fakedPortProbe, not these two paths, so both reached the real daemon.Fix
The
homefixture now pointsrun_dir.DEFAULT_PORTand the unit'shealth_portat a port nothing listens on. New tests: a guard that the unrecorded default is not 8424, and one that a stale record falls back to the unit's port (against a live listener there), so the fallback stays covered.test_installed_and_running_reports_version_and_portis unchanged and still uses a real loopback listener. No source or CHANGELOG change;statusbehaviour is unchanged.Evidence
Before (real biffd on 8424),
pytest tests/test_daemon/test_service_cli.py -k TestDaemonStatus:test_not_installed:assert (0, True) == (1, True)test_installed_but_not_answering_exits_1:assert (0, False) == (1, True)assert 8424 != 8424After, real biffd still listening on 8424 (confirmed with lsof): tests/test_daemon/test_service_cli.py all pass (56); tests/test_daemon + tests/test_supervision pass. ruff, ruff format, mypy clean on the file.