diff --git a/pkg/executor/build_test.go b/pkg/executor/build_test.go index 20391a3a0..da0b6d44d 100644 --- a/pkg/executor/build_test.go +++ b/pkg/executor/build_test.go @@ -371,10 +371,15 @@ func Test_filesToSave(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { tmpDir, err := ioutil.TempDir("", "") + original := config.RootDir + config.RootDir = tmpDir if err != nil { t.Errorf("error creating tmpdir: %s", err) } - defer os.RemoveAll(tmpDir) + defer func () { + config.RootDir = original + os.RemoveAll(tmpDir) + }() for _, f := range tt.files { p := filepath.Join(tmpDir, f) diff --git a/pkg/snapshot/snapshot_test.go b/pkg/snapshot/snapshot_test.go index 19fc9c4cb..a6553228d 100644 --- a/pkg/snapshot/snapshot_test.go +++ b/pkg/snapshot/snapshot_test.go @@ -25,6 +25,7 @@ import ( "strings" "testing" + "github.com/GoogleContainerTools/kaniko/pkg/config" "github.com/GoogleContainerTools/kaniko/pkg/util" "github.com/GoogleContainerTools/kaniko/testutil" "github.com/pkg/errors" @@ -159,7 +160,6 @@ func TestSnapshotFSChangePermissions(t *testing.T) { if err == io.EOF { break } - t.Logf("Info %s in tar", hdr.Name) foundFiles = append(foundFiles, hdr.Name) if _, isFile := snapshotFiles[hdr.Name]; !isFile { t.Fatalf("File %s unexpectedly in tar", hdr.Name) @@ -458,8 +458,11 @@ func setUpTest() (string, *Snapshotter, func(), error) { return "", nil, nil, errors.Wrap(err, "initializing snapshotter") } + original := config.KanikoDir + config.KanikoDir = testDir cleanup := func() { os.RemoveAll(snapshotPath) + config.KanikoDir = original dirCleanUp() } diff --git a/pkg/util/command_util.go b/pkg/util/command_util.go index 67343685c..d2a604c1e 100644 --- a/pkg/util/command_util.go +++ b/pkg/util/command_util.go @@ -131,7 +131,6 @@ func ResolveSources(srcs []string, root string) ([]string, error) { return nil, errors.Wrap(err, "matching sources") } logrus.Debugf("Resolved sources to %v", resolved) - fmt.Println("end of resolve sources") return resolved, nil }