summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormefyl <quentin.hocquet@docker.com>2018-02-26 12:17:34 +0100
committermefyl <quentin.hocquet@docker.com>2018-02-26 12:59:46 +0100
commit429591910359dd7487dc111298eaf1f36121631d (patch)
treed3cd3f00554273f2c3c71296ccd9babbe1319f12
parent0c948c7df65b0d7378c3c0c8d966c38171f1ef21 (diff)
downloaddocker-py-429591910359dd7487dc111298eaf1f36121631d.tar.gz
Add test for "/.." patterns in .dockerignore.
Signed-off-by: mefyl <quentin.hocquet@docker.com>
-rw-r--r--tests/unit/utils_test.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/unit/utils_test.py b/tests/unit/utils_test.py
index 8a4b193..c2dd502 100644
--- a/tests/unit/utils_test.py
+++ b/tests/unit/utils_test.py
@@ -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):