|
4 | 4 | "bytes"
|
5 | 5 | "fmt"
|
6 | 6 | "os"
|
| 7 | + "path/filepath" |
7 | 8 | "runtime"
|
8 | 9 | "sort"
|
9 | 10 | "strings"
|
@@ -692,23 +693,25 @@ image_copy_tmp_dir="storage"`
|
692 | 693 | gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
|
693 | 694 | gomega.Expect(newConfigs).To(gomega.Equal(configs))
|
694 | 695 |
|
695 |
| - dir, err := os.MkdirTemp("", "configTest") |
696 |
| - gomega.Expect(err).ShouldNot(gomega.HaveOccurred()) |
697 |
| - defer os.RemoveAll(dir) |
| 696 | + t := GinkgoT() |
| 697 | + dir := t.TempDir() |
698 | 698 | file1 := tmpFilePath(dir, "b")
|
699 | 699 | file2 := tmpFilePath(dir, "a")
|
700 | 700 | file3 := tmpFilePath(dir, "2")
|
701 | 701 | file4 := tmpFilePath(dir, "1")
|
702 | 702 | // create a file in dir that is not a .conf to make sure
|
703 | 703 | // it does not show up in configs
|
704 |
| - _, err = os.CreateTemp(dir, "notconf") |
| 704 | + f, err := os.CreateTemp(dir, "notconf") |
705 | 705 | gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
|
706 |
| - subdir, err := os.MkdirTemp(dir, "") |
| 706 | + f.Close() |
| 707 | + subdir := filepath.Join(dir, "subdir") |
| 708 | + err = os.Mkdir(subdir, 0o700) |
707 | 709 | gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
|
708 | 710 | // create a file in subdir, to make sure it does not
|
709 | 711 | // show up in configs
|
710 |
| - _, err = os.CreateTemp(subdir, "") |
| 712 | + f, err = os.CreateTemp(subdir, "") |
711 | 713 | gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
|
| 714 | + f.Close() |
712 | 715 |
|
713 | 716 | newConfigs, err = addConfigs(dir, configs)
|
714 | 717 | gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
|
|
0 commit comments