diff options
author | Ed Santiago <santiago@redhat.com> | 2020-08-17 10:26:18 -0600 |
---|---|---|
committer | Ed Santiago <santiago@redhat.com> | 2020-08-18 09:12:09 -0600 |
commit | bc07e1ba708f38b6ea21204b4b0ef9d777c0fcc5 (patch) | |
tree | d26055949dfb1069676bcf26348db79eab1194f3 /test/e2e/commit_test.go | |
parent | 748e8829da76394ec956ea6590599fab01b467b7 (diff) | |
download | podman-bc07e1ba708f38b6ea21204b4b0ef9d777c0fcc5.tar.gz podman-bc07e1ba708f38b6ea21204b4b0ef9d777c0fcc5.tar.bz2 podman-bc07e1ba708f38b6ea21204b4b0ef9d777c0fcc5.zip |
e2e tests: use actual temp dirs, not "/tmp/dir"
One of the --iidfile tests was flaking:
Error: failed to write image ID to file "/tmp/dir/idFile": open /tmp/dir/idFile: no such file or directory
Root cause: test was actually not mkdir'ing /tmp/dir. Test was
mostly passing because _other_ tests in the suite were mkdir'ing
it, but once in a while this test ran before the others.
Solution: fixed this test to use CreateTempDirInTempDir(). And,
since hardcoded tempdirs are bad practice, grepped for '"dir"'
and fixed all other instances too.
Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/e2e/commit_test.go')
-rw-r--r-- | test/e2e/commit_test.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go index c122ce50f..c1a213c00 100644 --- a/test/e2e/commit_test.go +++ b/test/e2e/commit_test.go @@ -257,8 +257,10 @@ var _ = Describe("Podman commit", func() { cwd, err := os.Getwd() Expect(err).To(BeNil()) Expect(os.Chdir(os.TempDir())).To(BeNil()) - targetPath := filepath.Join(os.TempDir(), "dir") - Expect(os.MkdirAll(targetPath, 0755)).To(BeNil()) + targetPath, err := CreateTempDirInTempDir() + if err != nil { + os.Exit(1) + } targetFile := filepath.Join(targetPath, "idFile") defer Expect(os.RemoveAll(targetFile)).To(BeNil()) defer Expect(os.Chdir(cwd)).To(BeNil()) |