Skip to content

Commit

Permalink
remote,test: remove .dockerignore which is a symlink
Browse files Browse the repository at this point in the history
It seems certain test infrastructure prevents cloning repo which
contains symlink outside of the repo itself, generate symlink for such
test by the testsuite itself just before running test and remove it when
test is completed.

Signed-off-by: Aditya R <arajan@redhat.com>
  • Loading branch information
flouthoc committed Nov 3, 2023
1 parent 0904c19 commit 54cfdf4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion test/e2e/build/containerignore-symlink/.dockerignore

This file was deleted.

13 changes: 12 additions & 1 deletion test/e2e/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 54cfdf4

Please sign in to comment.