From c8227d2421f5fd481fca621b3219d55c13d6e1f1 Mon Sep 17 00:00:00 2001 From: Jonathon Reinhart Date: Mon, 1 Feb 2016 21:26:31 -0500 Subject: [PATCH] Add test for -d (arbitrary docker args) --- tests/test_main.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/test_main.py b/tests/test_main.py index aeffda30..053358a1 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -11,7 +11,7 @@ import logging import os import sys -from tempfile import mkdtemp, TemporaryFile +from tempfile import mkdtemp, TemporaryFile, NamedTemporaryFile from shutil import rmtree import scuba.__main__ as main @@ -260,3 +260,25 @@ def test_user_root(self): assert_equal(username, 'root') assert_equal(gid, 0) assert_equal(groupname, 'root') + + + def test_arbitrary_docker_args(self): + '''Verify -d successfully passes arbitrary docker arguments''' + + with open('.scuba.yml', 'w') as f: + f.write('image: {0}\n'.format(DOCKER_IMAGE)) + + data = 'Lorem ipsum dolor sit amet' + data_path = '/lorem/ipsum' + + with NamedTemporaryFile(mode='wt') as tempf: + tempf.write(data) + tempf.flush() + + args = [ + '-d=-v {0}:{1}:ro,z'.format(tempf.name, data_path), + 'cat', data_path, + ] + out, _ = self.run_scuba(args) + + assert_str_equalish(out, data)