Commit 803dc0c7 authored by Peter Parente's avatar Peter Parente

Fix bogus assert, add mount test

parent 463490fb
...@@ -71,31 +71,42 @@ def test_sudo(container): ...@@ -71,31 +71,42 @@ def test_sudo(container):
assert rv == 0 assert rv == 0
assert 'uid=0(root)' in c.logs(stdout=True).decode('utf-8') assert 'uid=0(root)' in c.logs(stdout=True).decode('utf-8')
@pytest.mark.dev
def test_group_add(container): def test_group_add(container, tmpdir):
"""Container should run with the specified uid, gid, and secondary """Container should run with the specified uid, gid, and secondary
group, but retain unprivileged access to the conda path. group.
""" """
c = container.run( c = container.run(
user='1010:1010', user='1010:1010',
group_add=['users'], group_add=['users'],
command=['start.sh', 'bash', '-c', 'id && touch /opt/conda/test-file'] command=['start.sh', 'id']
) )
rv = c.wait(timeout=5) rv = c.wait(timeout=5)
assert rv == 0 assert rv == 0
assert 'uid=1010 gid=1010 groups=1010,100(users)' in c.logs(stdout=True).decode('utf-8') assert 'uid=1010 gid=1010 groups=1010,100(users)' in c.logs(stdout=True).decode('utf-8')
@pytest.mark.dev
@pytest.mark.skip('placeholder') def test_host_mount(container, tmpdir):
def test_host_mount(container):
"""Container should start the notebook server properly when """Container should start the notebook server properly when
the user home directory is host mounted. the user home directory is host mounted.
""" """
pass path = tmpdir.mkdir('home').join('test.sh')
path.write('''\
#!/bin/bash
echo "test content" > test.txt
cat test.txt
''')
path.chmod(0o755)
@pytest.mark.skip('placeholder') c = container.run(
def test_alt_command(): volumes={
"""Container should launch an alternative command.""" path.dirname: {'bind': '/home/jovyan', 'mode': 'rw'},
pass },
command=['start.sh', '/home/jovyan/test.sh']
)
rv = c.wait(timeout=5)
stdout = c.logs(stdout=True).decode('utf-8')
print(stdout)
assert rv == 0
assert 'test content' in stdout
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment