test(schedule): ignore pre-existing schedules in the final assertion - #672
Open
l1a wants to merge 1 commit into
Open
test(schedule): ignore pre-existing schedules in the final assertion#672l1a wants to merge 1 commit into
l1a wants to merge 1 commit into
Conversation
TestReadingSystemdScheduled fails on any machine that has a real
resticprofile schedule installed:
Error: Should be empty, but was [{dot-files backup [hourly] ...}]
Test: TestReadingSystemdScheduled
Scheduled() reads the user's real systemd unit directory, so it returns
the developer's own schedules alongside the ones the test creates. The
test already accounts for that when building the list it compares with
ElementsMatch, but the final assert.Empty check uses the unfiltered
slice, so it sees whatever else is installed.
Extract the existing filter into a helper and use it in both places.
Assisted-By: Claude Opus 5
l1a
added a commit
to l1a/resticprofile
that referenced
this pull request
Jul 30, 2026
- PRs 1, 3 and 5 are now open upstream as creativeprojects#670, creativeprojects#672 and creativeprojects#671. Note that they are opened with ghpub, since the default fine-grained PAT cannot create pull requests on repositories we do not own. - Flag that creativeprojects#672 conflicts with our own master: the fork already fixed that same test differently in 1282c8d (before/after count rather than filtering). Records how to resolve it on the next merge. - Quote issue creativeprojects#331, where the maintainer states linger is not something resticprofile should set up automatically and drop-in files are the sanctioned mechanism. Wave 4A must not be opened as-is; notes the warning-instead-of-enforcement slice that could land. - Correct the mock drift note: mockery v3.7.0 vs upstream's pinned v3.7.1 is the likelier cause, and mark the check as unconfirmed. - Keep PR 3 and 5 bodies alongside PR 1's in upstream-prs/. Assisted-By: Claude Opus 5
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
TestReadingSystemdScheduledfails on any machine that has a real resticprofile schedule installed:Scheduled()reads the user's real systemd unit directory, so it returns the developer's own schedules alongside the two the test creates.The test already accounts for this when it builds the list it compares with
ElementsMatch— it skips anything whoseConfigFileisn't one of its own fixtures. But the finalassert.Emptycheck a few lines later uses the raw, unfiltered slice, so it sees whatever else happens to be installed on the machine.Net effect: the suite passes on a clean CI runner and fails locally for anyone who actually uses resticprofile.
Fix
Extract the filter the test already contains into a small helper and use it in both assertions. No production code touched.
Verification
Before, on a machine with one real hourly schedule installed:
After:
The two log lines are the same real schedule being skipped at each of the two filter points, which is exactly the case that was failing.
make buildandmake lintpass (0 issues on darwin, linux and windows), and the pre-existing schedule I had installed was still present and enabled afterwards.🤖 Generated with Claude Code