diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-13 09:35:46 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-13 09:35:46 +0300 |
| commit | e9c747c607e14d8b8f69547aa3c0f3b079c20796 (patch) | |
| tree | b5c461f3ace5e7785ed9716fdc136ff985475440 /internal/flags | |
| parent | b086d3680e845a94c6662811c7f40e9592c3dec6 (diff) | |
replace package-level test doubles in ior.go with constructor injection (DIP)
Introduce runnerDeps struct to bundle all injectable function dependencies
(getEUID, runTrace, runParquet, runTraceWithContext, runTUI*) that were
previously package-level vars overridden in tests. The modeRegistry now
carries a runnerDeps instance and passes it to each handler's run() method,
eliminating global state mutation in tests.
- Add runnerDeps struct and defaultRunnerDeps() constructor in ior_mode_registry.go
- Convert modeRegistry from a []modeHandler slice type to a struct with
handlers + deps fields; add newModeRegistry(deps) constructor
- Update modeHandler.run() signature to accept runnerDeps; handlers call
deps.getEUID / deps.runTrace etc. instead of globals
- Update SetTUIRunners to write into defaultRegistry.deps instead of
package-level vars
- Add dispatchRunWithDeps helper for test isolation without global mutation
- Remove root-privilege check from runTraceWithContext and runHeadlessParquet;
each mode handler owns the EUID gate via deps.getEUID
- Rewrite ior_mode_test.go: replace save/restore patterns with stubDeps()
helper and dispatchRunWithDeps; add three new root-privilege tests
replacing the removed TestRunTraceWithContextRequiresRoot
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/flags')
0 files changed, 0 insertions, 0 deletions
