Skip to content

Commit

Permalink
Add test for -d (arbitrary docker args)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathonReinhart committed Feb 4, 2016
1 parent 5c080b6 commit c8227d2
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

0 comments on commit c8227d2

Please sign in to comment.