mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-11 03:52:56 +00:00
adding test to check if container deleted files on container bind mount
This commit is contained in:
@@ -187,3 +187,29 @@ def test_group_add(container, tmpdir):
|
||||
assert rv == 0 or rv["StatusCode"] == 0
|
||||
logs = c.logs(stdout=True).decode("utf-8")
|
||||
assert "uid=1010 gid=1010 groups=1010,100(users)" in logs
|
||||
|
||||
def test_container_not_delete_bind_mount(container, tmp_path):
|
||||
"""Container should not delete files when using the -v bind mount flag
|
||||
and mappint to /home/jovyan.
|
||||
"""
|
||||
d = tmp_path / "data"
|
||||
d.mkdir()
|
||||
p = d / "foo.txt"
|
||||
p.write_text("some-content")
|
||||
|
||||
c = container.run(
|
||||
tty=True,
|
||||
user="root",
|
||||
working_dir="/home/",
|
||||
environment=[
|
||||
"NB_USER=user",
|
||||
"CHOWN_HOME=yes",
|
||||
],
|
||||
volumes={ d : {'bind': '/home/jovyan/data', 'mode': 'rw'}},
|
||||
command=["start.sh", "jupyter", "lab"]
|
||||
)
|
||||
|
||||
time.sleep(10)
|
||||
|
||||
assert p.read_text() == "some-content"
|
||||
assert len(list(tmp_path.iterdir())) == 1
|
||||
|
Reference in New Issue
Block a user