mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-09 19:12:59 +00:00
Fix bogus assert, add mount test
This commit is contained in:
@@ -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)
|
||||||
|
|
||||||
|
c = container.run(
|
||||||
@pytest.mark.skip('placeholder')
|
volumes={
|
||||||
def test_alt_command():
|
path.dirname: {'bind': '/home/jovyan', 'mode': 'rw'},
|
||||||
"""Container should launch an alternative command."""
|
},
|
||||||
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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user