mirror of
https://github.com/containers/podman.git
synced 2025-08-26 03:01:31 +08:00
test/e2e: fix incorrect usage of CreateTempDirInTempDir()
Creating a new diretory results in the test leaking it when it is not removed via a defer call. All tests have already access to `podmanTest.TempDir` which will be automatically removed in the `AfterEach()` block. While some test were fine other forgot the defer call. To keep the test consitent and prevent other from making the same mistake convert all users to `podmanTest.TempDir`. `CreateTempDirInTempDir()` is only used for the `podmanTest.Setup()` call. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -1072,9 +1072,7 @@ var _ = Describe("Podman kube generate", func() {
|
||||
containerfile := `FROM quay.io/libpod/alpine:latest
|
||||
ENTRYPOINT ["sleep"]`
|
||||
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
@ -1126,9 +1124,7 @@ ENTRYPOINT ["sleep"]`
|
||||
containerfile := `FROM quay.io/libpod/alpine:latest
|
||||
USER 1000`
|
||||
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
@ -1197,9 +1193,7 @@ USER 1000`
|
||||
RUN adduser -u 10001 -S test1
|
||||
USER test1`
|
||||
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
|
Reference in New Issue
Block a user