Skip to content

Commit 058229d

Browse files
authored
Add non-root test
1 parent b6ab91a commit 058229d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

base-notebook/test/test_container_options.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,13 @@ def test_container_not_delete_bind_mount(container, tmp_path):
240240
assert len(list(tmp_path.iterdir())) == 1
241241

242242

243-
def test_jupyter_env_vars_to_unset_as_root(container):
243+
@pytest.mark.parametrize("enable_root", [False, True])
244+
def test_jupyter_env_vars_to_unset_as_root(container, enable_root):
244245
"""Environment variables names listed in JUPYTER_ENV_VARS_TO_UNSET
245246
should be unset in the final environment."""
247+
root_args = {"user": "root"} if enable_root else {}
246248
c = container.run(
247249
tty=True,
248-
user="root",
249250
environment=[
250251
"JUPYTER_ENV_VARS_TO_UNSET=SECRET_ANIMAL,UNUSED_ENV,SECRET_FRUIT",
251252
"FRUIT=bananas",
@@ -258,6 +259,7 @@ def test_jupyter_env_vars_to_unset_as_root(container):
258259
"-c",
259260
"echo I like $FRUIT and ${SECRET_FRUIT:-stuff}, and love ${SECRET_ANIMAL:-to keep secrets}!",
260261
],
262+
**root_args,
261263
)
262264
rv = c.wait(timeout=10)
263265
assert rv == 0 or rv["StatusCode"] == 0

0 commit comments

Comments
 (0)