diff --git a/cmd/entrypoint/post_writer_test.go b/cmd/entrypoint/post_writer_test.go index a0ce5c1fe1e..dba13f39219 100644 --- a/cmd/entrypoint/post_writer_test.go +++ b/cmd/entrypoint/post_writer_test.go @@ -1,6 +1,7 @@ package main import ( + "io/ioutil" "os" "testing" ) @@ -27,7 +28,7 @@ func TestRealPostWriter_WriteFileContent(t *testing.T) { if _, err := os.Stat(tt.file); err != nil { t.Fatalf("Failed to create a file %q", tt.file) } - b, err := os.ReadFile(tt.file) + b, err := ioutil.ReadFile(tt.file) if err != nil { t.Fatalf("Failed to read the file %q", tt.file) } diff --git a/pkg/entrypoint/entrypointer_test.go b/pkg/entrypoint/entrypointer_test.go index 6bca90389cc..df0fbfccf5b 100644 --- a/pkg/entrypoint/entrypointer_test.go +++ b/pkg/entrypoint/entrypointer_test.go @@ -86,6 +86,13 @@ func TestEntrypointerFailures(t *testing.T) { fr = &fakeRunner{} } fpw := &fakePostWriter{} + terminationPath := "termination" + if terminationFile, err := ioutil.TempFile("", "termination"); err != nil { + t.Fatalf("unexpected error creating temporary termination file: %v", err) + } else { + terminationPath = terminationFile.Name() + defer os.Remove(terminationFile.Name()) + } err := Entrypointer{ Entrypoint: "echo", WaitFiles: c.waitFiles, @@ -94,7 +101,7 @@ func TestEntrypointerFailures(t *testing.T) { Waiter: fw, Runner: fr, PostWriter: fpw, - TerminationPath: "termination", + TerminationPath: terminationPath, Timeout: &c.timeout, }.Go() if err == nil {