Commit graph

4 commits

Author SHA1 Message Date
Michael Vogt
bb45b89d84 testutil: remove unnecessary testutil.MockCmd.Restore()
While looking over the code I noticed that the `Restore()` helper
is not needed (and arguably wrong as it does not reset PATH).
We already use `t.TempDir()` and `t.Setenv()` as part of the
command setup so manually cleanup is not neccessary (and is today
even incomplete). So YAGNI and we can remove Restore().
2025-07-17 06:44:29 +00:00
Michael Vogt
2f0caddf91 testutil: add testutil.Chdir() helper
A tiny helper to run a specific function inside a different dir,
useful in our testsuite.
2025-03-14 14:47:36 +00:00
Michael Vogt
e41cf0e429 testutil: add new CaptureStdio helper
This commit adds a new testutil.CaptureStdio helper so that we
can test external go modules that use os.Std{out,err} but now
allow mocking or overwriting.
2025-01-29 15:21:33 +00:00
Michael Vogt
ce8dd45821 testutil: new package to test run osbuild run functionality
This commit adds a new testutil.MockCommand() helper that will
mock a command in $PATH to allow easier testing of e.g. the
`image-builder-cli build` comamnd that will invoke osbuild.
2024-12-16 14:59:08 +00:00