mirror of
https://github.com/containers/podman.git
synced 2025-07-01 16:17:06 +08:00
Merge pull request #22532 from Luap99/more-e2e-fixes
test/e2e: more fixes to not leak tmp files/dirs
This commit is contained in:
@ -441,7 +441,7 @@ RUN find /test`, CITEST_IMAGE)
|
||||
It("podman remote build must not allow symlink for ignore files", func() {
|
||||
// Create a random file where symlink must be resolved
|
||||
// but build should not be able to access it.
|
||||
privateFile := filepath.Join("/tmp", "private_file")
|
||||
privateFile := filepath.Join(podmanTest.TempDir, "private_file")
|
||||
f, err := os.Create(privateFile)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Mark hello to be ignored in outerfile, but it should not be ignored.
|
||||
@ -449,16 +449,14 @@ RUN find /test`, CITEST_IMAGE)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer f.Close()
|
||||
|
||||
// Create .dockerignore which is a symlink to /tmp/private_file.
|
||||
// Create .dockerignore which is a symlink to /tmp/.../private_file outside of the context dir.
|
||||
currentDir, err := os.Getwd()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
ignoreFile := filepath.Join(currentDir, "build/containerignore-symlink/.dockerignore")
|
||||
err = os.Symlink(privateFile, ignoreFile)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Remove created .dockerignore for this test when test ends.
|
||||
defer func() {
|
||||
os.Remove(ignoreFile)
|
||||
}()
|
||||
defer os.Remove(ignoreFile)
|
||||
|
||||
if IsRemote() {
|
||||
podmanTest.StopRemoteService()
|
||||
|
@ -1,6 +1,8 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"slices"
|
||||
|
||||
. "github.com/containers/podman/v5/test/utils"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
@ -63,5 +65,14 @@ var _ = Describe("Podman mount", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToString()).To(ContainSubstring(podmanTest.TempDir))
|
||||
|
||||
// We have to unmount the image again otherwise we leak the tmpdir
|
||||
// as active mount points cannot be removed.
|
||||
index := slices.Index(args, "mount")
|
||||
Expect(index).To(BeNumerically(">", 0), "index should be found")
|
||||
args[index] = "unmount"
|
||||
session = podmanTest.Podman(args)
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
})
|
||||
})
|
||||
|
@ -4093,7 +4093,7 @@ o: {{ .Options.o }}`})
|
||||
It("persistentVolumeClaim with source", func() {
|
||||
fileName := "data"
|
||||
expectedFileContent := "Test"
|
||||
tarFilePath := filepath.Join(os.TempDir(), "podmanVolumeSource.tgz")
|
||||
tarFilePath := filepath.Join(podmanTest.TempDir, "podmanVolumeSource.tgz")
|
||||
err := createSourceTarFile(fileName, expectedFileContent, tarFilePath)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
|
Reference in New Issue
Block a user