fix(test): stop the load_configs test reading the developer's real config#456
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
401fbcc to
b013e8c
Compare
|
Isn't every integration test that touches indexes or custom sources affected by this? Do they all pass |
The test called load_configs, which merges the user configuration from dirs::config_dir(), so it asserted against whatever ~/.config/sysand/sysand.toml happens to contain: green on CI runners, red on any developer machine with a real config. Split the loader into load_configs_from with the user-config location injected; load_configs delegates with the dirs lookup, public behavior unchanged. The test passes None, and a new test covers the user-then-working-dir merge through the injected path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EfyrkJkeo3mRngVoppJjUN Signed-off-by: Erik Sundell <erik.sundell+2025@sensmetry.com>
Good instinct to check, but they're already covered — the exposure was narrower than it looks. The real let args = args
.into_iter()
.chain(["--no-config"])
.chain(cfg.iter().flat_map(|cfg| ["--config-file", cfg]));
That's exactly why the unit test was the one exposure: it called the library One fair follow-up your question surfaces: isolation for the whole CLI suite rests entirely on that single |
b013e8c to
0986dc6
Compare
Co-authored-by: Andrius Pukšta <andrius.puksta@sensmetry.com> Signed-off-by: Erik Sundell <erik.i.sundell@gmail.com>
The `wrapfs::write` line from the GitHub-applied review suggestion exceeded the line width; `cargo fmt` wraps it. No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CPfB9S7WwNyqx6xsfTwKmF Signed-off-by: Erik Sundell <erik.sundell+2025@sensmetry.com>
config::local_fs::tests::load_configscallsload_configs, which merges the user configuration fromdirs::config_dir()before asserting equality against a fixture. The assertion therefore depends on whatever~/.config/sysand/sysand.tomlhappens to contain: green on CI runners (no user config), red on any developer machine where sysand is actually used, with the developer's own index entries showing up in the assertion diff.Fix by injection rather than environment mutation (mutating
HOME/XDG_CONFIG_HOMEin tests is racy under the multithreaded test runner): the loader is split intoload_configs_from(user_config: Option<&Utf8Path>, working_dir), andload_configsdelegates to it with thedirslookup, so public behavior is unchanged. The existing test passesNone; a new test exercises the user-then-working-dir merge through the injected path, which was previously untestable in isolation.Verified on a machine with a real user config (which reproduced the failure before the fix): the config tests and the full core suite pass.
🤖 Generated with Claude Code
https://claude.ai/code/session_01EfyrkJkeo3mRngVoppJjUN