mirror of
https://github.com/containers/podman.git
synced 2025-06-30 15:49:03 +08:00
test/e2e: do not leak /tmp/private_file
This should use the proper per test tempdir which works just as well for the purpose. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
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() {
|
It("podman remote build must not allow symlink for ignore files", func() {
|
||||||
// Create a random file where symlink must be resolved
|
// Create a random file where symlink must be resolved
|
||||||
// but build should not be able to access it.
|
// 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)
|
f, err := os.Create(privateFile)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
// Mark hello to be ignored in outerfile, but it should not be ignored.
|
// 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())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
defer f.Close()
|
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()
|
currentDir, err := os.Getwd()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
ignoreFile := filepath.Join(currentDir, "build/containerignore-symlink/.dockerignore")
|
ignoreFile := filepath.Join(currentDir, "build/containerignore-symlink/.dockerignore")
|
||||||
err = os.Symlink(privateFile, ignoreFile)
|
err = os.Symlink(privateFile, ignoreFile)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
// Remove created .dockerignore for this test when test ends.
|
// Remove created .dockerignore for this test when test ends.
|
||||||
defer func() {
|
defer os.Remove(ignoreFile)
|
||||||
os.Remove(ignoreFile)
|
|
||||||
}()
|
|
||||||
|
|
||||||
if IsRemote() {
|
if IsRemote() {
|
||||||
podmanTest.StopRemoteService()
|
podmanTest.StopRemoteService()
|
||||||
|
Reference in New Issue
Block a user