mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00
Merge pull request #7341 from edsantiago/e2e_use_tmpdirs
e2e tests: use actual temp dirs, not "/tmp/dir"
This commit is contained in:
@ -127,8 +127,10 @@ var _ = Describe("Podman build", func() {
|
|||||||
defer Expect(os.Chdir(cwd)).To(BeNil())
|
defer Expect(os.Chdir(cwd)).To(BeNil())
|
||||||
|
|
||||||
// Write target and fake files
|
// Write target and fake files
|
||||||
targetPath := filepath.Join(os.TempDir(), "dir")
|
targetPath, err := CreateTempDirInTempDir()
|
||||||
Expect(os.MkdirAll(targetPath, 0755)).To(BeNil())
|
if err != nil {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
fakeFile := filepath.Join(os.TempDir(), "Containerfile")
|
fakeFile := filepath.Join(os.TempDir(), "Containerfile")
|
||||||
Expect(ioutil.WriteFile(fakeFile, []byte("FROM alpine"), 0755)).To(BeNil())
|
Expect(ioutil.WriteFile(fakeFile, []byte("FROM alpine"), 0755)).To(BeNil())
|
||||||
@ -162,7 +164,10 @@ var _ = Describe("Podman build", func() {
|
|||||||
Expect(os.Chdir(os.TempDir())).To(BeNil())
|
Expect(os.Chdir(os.TempDir())).To(BeNil())
|
||||||
defer Expect(os.Chdir(cwd)).To(BeNil())
|
defer Expect(os.Chdir(cwd)).To(BeNil())
|
||||||
|
|
||||||
targetPath := filepath.Join(os.TempDir(), "dir")
|
targetPath, err := CreateTempDirInTempDir()
|
||||||
|
if err != nil {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
targetFile := filepath.Join(targetPath, "idFile")
|
targetFile := filepath.Join(targetPath, "idFile")
|
||||||
|
|
||||||
session := podmanTest.PodmanNoCache([]string{"build", "build/basicalpine", "--iidfile", targetFile})
|
session := podmanTest.PodmanNoCache([]string{"build", "build/basicalpine", "--iidfile", targetFile})
|
||||||
|
@ -257,8 +257,10 @@ var _ = Describe("Podman commit", func() {
|
|||||||
cwd, err := os.Getwd()
|
cwd, err := os.Getwd()
|
||||||
Expect(err).To(BeNil())
|
Expect(err).To(BeNil())
|
||||||
Expect(os.Chdir(os.TempDir())).To(BeNil())
|
Expect(os.Chdir(os.TempDir())).To(BeNil())
|
||||||
targetPath := filepath.Join(os.TempDir(), "dir")
|
targetPath, err := CreateTempDirInTempDir()
|
||||||
Expect(os.MkdirAll(targetPath, 0755)).To(BeNil())
|
if err != nil {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
targetFile := filepath.Join(targetPath, "idFile")
|
targetFile := filepath.Join(targetPath, "idFile")
|
||||||
defer Expect(os.RemoveAll(targetFile)).To(BeNil())
|
defer Expect(os.RemoveAll(targetFile)).To(BeNil())
|
||||||
defer Expect(os.Chdir(cwd)).To(BeNil())
|
defer Expect(os.Chdir(cwd)).To(BeNil())
|
||||||
|
@ -296,8 +296,10 @@ var _ = Describe("Podman pod create", func() {
|
|||||||
cwd, err := os.Getwd()
|
cwd, err := os.Getwd()
|
||||||
Expect(err).To(BeNil())
|
Expect(err).To(BeNil())
|
||||||
Expect(os.Chdir(os.TempDir())).To(BeNil())
|
Expect(os.Chdir(os.TempDir())).To(BeNil())
|
||||||
targetPath := filepath.Join(os.TempDir(), "dir")
|
targetPath, err := CreateTempDirInTempDir()
|
||||||
Expect(os.MkdirAll(targetPath, 0755)).To(BeNil())
|
if err != nil {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
targetFile := filepath.Join(targetPath, "idFile")
|
targetFile := filepath.Join(targetPath, "idFile")
|
||||||
defer Expect(os.RemoveAll(targetFile)).To(BeNil())
|
defer Expect(os.RemoveAll(targetFile)).To(BeNil())
|
||||||
defer Expect(os.Chdir(cwd)).To(BeNil())
|
defer Expect(os.Chdir(cwd)).To(BeNil())
|
||||||
|
Reference in New Issue
Block a user