Repository navigation
fork-kit/cleaner: tests use their own home folder, never the runner's - #1458
Merged
Merged
Conversation
A command reads its config from the machine file, and Config then took the home folder from the password database, not the test's HOME. So the report command tests measured the runner's real home, and on a machine with less free disk than report.warnFreeGB (60 GB) walked all of it for many minutes. config.HOME (tests only, like MACHINE_FILE) names the home instead; the shared fixture sets it to the test's own temp home for every cleaner test. A new report test checks the command's home is the test's own. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Command.test_the_command_reads_the_machine_file(report.test.py) ranfork-cleaner reportagainst the real home folder of the user running the tests. The command reads its config from the machine file, andConfigthen took the home folder from the password database, ignoring the fixture'sHOME. On a machine with less free disk thanreport.warnFreeGB(60 GB by default) the report walks the whole home for its LOW DISK line, so the test hung for many minutes.Change
config.HOME: a tests-only hook likeMACHINE_FILE. When set,Configuses it as the home folder. Production leaves itNone, so nothing changes there.cleaner_fixture.Case.setUpsets it to the test's own temp home for every cleaner test. That covers the report test above and the other command tests that go through the machine file (engineplan/run, dailycompare/daily/plan). Those readcfg.hometoo, though they don't walk it. No cleaner test reads the runner's real home now. (facts.read_unitsalready used~, which honours the fixture'sHOME.)Command.test_the_command_measures_the_tests_own_home_and_not_the_runners. It setswarnFreeGBvery high so the LOW DISK walk always runs, then checks thatconfig.load().homeand the folder the report names are the test's own home.Before / after
The existing command test was timed with its machine file set to
warnFreeGB: 100000, which acts like a low-disk runner:timeoutkilled it (exit 124)Without the fix, the new test fails at once:
'<real home>' != '<temp>/home'.report.test.py(40 tests),engine.test.py(55) anddaily.test.py(28) all pass locally. I did not add a red-check mutation for the hook on purpose: the mutated copy would walk the runner's real home, which is the hang this PR removes.🤖 Generated with Claude Code