mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-14 13:32:56 +00:00
Add non-root test
This commit is contained in:
@@ -240,12 +240,13 @@ def test_container_not_delete_bind_mount(container, tmp_path):
|
||||
assert len(list(tmp_path.iterdir())) == 1
|
||||
|
||||
|
||||
def test_jupyter_env_vars_to_unset_as_root(container):
|
||||
@pytest.mark.parametrize("enable_root", [False, True])
|
||||
def test_jupyter_env_vars_to_unset_as_root(container, enable_root):
|
||||
"""Environment variables names listed in JUPYTER_ENV_VARS_TO_UNSET
|
||||
should be unset in the final environment."""
|
||||
root_args = {"user": "root"} if enable_root else {}
|
||||
c = container.run(
|
||||
tty=True,
|
||||
user="root",
|
||||
environment=[
|
||||
"JUPYTER_ENV_VARS_TO_UNSET=SECRET_ANIMAL,UNUSED_ENV,SECRET_FRUIT",
|
||||
"FRUIT=bananas",
|
||||
@@ -258,6 +259,7 @@ def test_jupyter_env_vars_to_unset_as_root(container):
|
||||
"-c",
|
||||
"echo I like $FRUIT and ${SECRET_FRUIT:-stuff}, and love ${SECRET_ANIMAL:-to keep secrets}!",
|
||||
],
|
||||
**root_args,
|
||||
)
|
||||
rv = c.wait(timeout=10)
|
||||
assert rv == 0 or rv["StatusCode"] == 0
|
||||
|
Reference in New Issue
Block a user