Add test for "/.." patterns in .dockerignore.

Signed-off-by: mefyl <quentin.hocquet@docker.com>
This commit is contained in:
mefyl 2018-02-26 12:17:34 +01:00
parent 0c948c7df6
commit 4295919103
No known key found for this signature in database
GPG Key ID: 0891F9C2A28563BB
1 changed files with 16 additions and 0 deletions

View File

@ -902,6 +902,22 @@ class ExcludePathsTest(unittest.TestCase):
['*.md', '!README*.md', 'README-secret.md']
) == set(['README.md', 'README-bis.md'])
def test_parent_directory(self):
base = make_tree(
[],
['a.py',
'b.py',
'c.py'])
# Dockerignore reference stipulates that absolute paths are
# equivalent to relative paths, hence /../foo should be
# equivalent to ../foo. It also stipulates that paths are run
# through Go's filepath.Clean, which explicitely "replace
# "/.." by "/" at the beginning of a path".
assert exclude_paths(
base,
['../a.py', '/../b.py']
) == set(['c.py'])
class TarTest(unittest.TestCase):
def test_tar_with_excludes(self):