Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code_sandboxes/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.11.0"
__version__ = "1.11.1"
2 changes: 1 addition & 1 deletion code_sandboxes/environments/adapters/datalayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def _contract_user() -> list[str]:
f"&& if getent passwd {uid} >/dev/null; then "
f'usermod -l {user} -g {gid} -d {home} "$(getent passwd {uid} | cut -d: -f1)"; '
f"else useradd -u {uid} -g {gid} -d {home} -s /bin/bash {user}; fi "
f"&& mkdir -p {home}/.local/share/jupyter/runtime/external_kernels "
f"&& mkdir -p {home}/content {home}/.local/share/jupyter/runtime/external_kernels "
f"&& chown -R {uid}:{gid} {home}",
f"ENV HOME={home} LANG={contract.locale} LC_ALL={contract.locale} "
f"LANGUAGE={contract.locale} TZ=Etc/UTC PATH=$PATH:/opt/datalayer/bin",
Expand Down
11 changes: 11 additions & 0 deletions tests/test_environment_foreign_contract_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,3 +489,14 @@ def test_an_image_that_is_not_debian_derived_is_said_to_be(self, approved, tmp_p
base = self._digest("alpine:3.20")
with pytest.raises(AssertionError, match="not Debian-derived"):
solve_and_build(approved, tmp_path, image_source("alpine:3.20"), base)


def test_the_doctor_of_an_older_base_finds_its_working_directory():
"""The doctor is copied from the approved base, and a channel's may still
check `/home/datalayer/content`: an image of another make has to hold it,
the contract's user owning it, before that doctor runs."""
from code_sandboxes.environments.adapters.datalayer import _contract_user

created = next(line for line in _contract_user() if "external_kernels" in line)
assert "/home/datalayer/content" in created
assert created.index("/home/datalayer/content") < created.index("chown -R")
Loading