Skip to content

Commit

Permalink
Fixed review findings
Browse files Browse the repository at this point in the history
  • Loading branch information
ckunki committed Mar 6, 2024
1 parent 8ebe599 commit 6cded53
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion exasol/ds/sandbox/lib/dss_docker/create_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _commit_container(
"Cmd": [],
"Volumes": {notebook_folder_final: {}, },
"ExposedPorts": {f"{port}/tcp": {}},
"User": get_fact(facts, "docker_runner"),
"User": get_fact(facts, "docker_user"),
"Env": [
f"VIRTUAL_ENV={virtualenv}",
f"NOTEBOOK_FOLDER_FINAL={notebook_folder_final}",
Expand Down
2 changes: 1 addition & 1 deletion exasol/ds/sandbox/runtime/ansible/general_setup_tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
ansible.builtin.set_fact:
dss_facts:
entrypoint: "{{user_home}}/entrypoint.py"
docker_user: "{{ ansible_user }}"
docker_group: "{{ docker_group }}"
docker_runner: "{{ ansible_user }}"
jupyter:
virtualenv: "{{ jupyter_virtualenv }}"
command: "{{ jupyter_virtualenv }}/bin/jupyter-lab"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ def id(self):
self._id = grp.getgrnam(self.name).gr_gid
return self._id

def __eq__(self, other) -> bool:
if not isinstance(other, Group):
return False
return other.name == self.name


class User:
def __init__(self, user_name: str, group: Group, docker_group: Group):
Expand Down
9 changes: 5 additions & 4 deletions test/unit/entrypoint/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ def test_user_arg(mocker):
mocker.patch(entrypoint_method("sleep_infinity"))
entrypoint.main()
assert entrypoint.User.called
args = entrypoint.User.call_args[0]
assert args[0] == "jennifer"
assert args[1].name == "users"
assert args[2].name == "docker"
args = entrypoint.User.call_args = mocker.call(
"jennifer",
entrypoint.Group("users"),
entrypoint.Group("docker"),
)
assert user.own.called
assert user.own.call_args == mocker.call("/var/run/docker.sock")
assert user.switch_to.called
Expand Down

0 comments on commit 6cded53

Please sign in to comment.