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().
This commit is contained in:
parent
9717980d3f
commit
bb45b89d84
4 changed files with 7 additions and 22 deletions
|
|
@ -175,8 +175,7 @@ func TestBuildAndUploadWithAWSMock(t *testing.T) {
|
|||
|
||||
outputDir := t.TempDir()
|
||||
fakeOsbuildScript := makeFakeOsbuildScript()
|
||||
fakeOsbuildCmd := testutil.MockCommand(t, "osbuild", fakeOsbuildScript)
|
||||
defer fakeOsbuildCmd.Restore()
|
||||
testutil.MockCommand(t, "osbuild", fakeOsbuildScript)
|
||||
|
||||
var fakeStdout bytes.Buffer
|
||||
restore = main.MockOsStdout(&fakeStdout)
|
||||
|
|
@ -224,8 +223,7 @@ func TestBuildAmiButNotUpload(t *testing.T) {
|
|||
|
||||
outputDir := t.TempDir()
|
||||
fakeOsbuildScript := makeFakeOsbuildScript()
|
||||
fakeOsbuildCmd := testutil.MockCommand(t, "osbuild", fakeOsbuildScript)
|
||||
defer fakeOsbuildCmd.Restore()
|
||||
testutil.MockCommand(t, "osbuild", fakeOsbuildScript)
|
||||
|
||||
var fakeStdout bytes.Buffer
|
||||
restore = main.MockOsStdout(&fakeStdout)
|
||||
|
|
@ -255,8 +253,7 @@ func TestBuildAndUploadWithAWSPartialCmdlineErrors(t *testing.T) {
|
|||
|
||||
outputDir := t.TempDir()
|
||||
fakeOsbuildScript := makeFakeOsbuildScript()
|
||||
fakeOsbuildCmd := testutil.MockCommand(t, "osbuild", fakeOsbuildScript)
|
||||
defer fakeOsbuildCmd.Restore()
|
||||
testutil.MockCommand(t, "osbuild", fakeOsbuildScript)
|
||||
|
||||
restore := main.MockOsArgs([]string{
|
||||
"build",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue