Skip to content

Commit 4295919

Browse files
committed
Add test for "/.." patterns in .dockerignore.
Signed-off-by: mefyl <[email protected]>
1 parent 0c948c7 commit 4295919

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/unit/utils_test.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,22 @@ def test_last_line_precedence(self):
902902
['*.md', '!README*.md', 'README-secret.md']
903903
) == set(['README.md', 'README-bis.md'])
904904

905+
def test_parent_directory(self):
906+
base = make_tree(
907+
[],
908+
['a.py',
909+
'b.py',
910+
'c.py'])
911+
# Dockerignore reference stipulates that absolute paths are
912+
# equivalent to relative paths, hence /../foo should be
913+
# equivalent to ../foo. It also stipulates that paths are run
914+
# through Go's filepath.Clean, which explicitely "replace
915+
# "/.." by "/" at the beginning of a path".
916+
assert exclude_paths(
917+
base,
918+
['../a.py', '/../b.py']
919+
) == set(['c.py'])
920+
905921

906922
class TarTest(unittest.TestCase):
907923
def test_tar_with_excludes(self):

0 commit comments

Comments
 (0)