diff --git a/test/e2e/build/containerignore-symlink/.dockerignore b/test/e2e/build/containerignore-symlink/.dockerignore deleted file mode 120000 index 7ec132580625..000000000000 --- a/test/e2e/build/containerignore-symlink/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -/tmp/private_file \ No newline at end of file diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go index ab1b1d6b67c2..ff4f3acc143b 100644 --- a/test/e2e/build_test.go +++ b/test/e2e/build_test.go @@ -441,13 +441,24 @@ 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. - f, err := os.Create(filepath.Join("/tmp", "private_file")) + privateFile := filepath.Join("/tmp", "private_file") + f, err := os.Create(private_file) Expect(err).ToNot(HaveOccurred()) // Mark hello to be ignored in outerfile, but it should not be ignored. _, err = f.WriteString("hello\n") Expect(err).ToNot(HaveOccurred()) defer f.Close() + //Create .dockerignore which is a symlink to /tmp/private_file. + currentDir, err := os.Getwd() + Expect(err).ToNot(HaveOccurred()) + ignoreFile := filepath.Join(currentDir, "build/containerignore-symlink/.dockerignore") + err = os.Symlink(privateFile, ignoreFile) + // Remove created .dockerignore for this test when test ends. + defer func() { + os.Remove(ignoreFile) + }() + if IsRemote() { podmanTest.StopRemoteService() podmanTest.StartRemoteService()