Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RHOAIENG-17257: chore(tests): externalize the default workbench-starting arguments #856

Merged
Merged
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
31 changes: 17 additions & 14 deletions tests/containers/workbenches/workbench_image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,7 @@ def test_image_entrypoint_starts(self, image: str, sysctls) -> None:
skip_if_not_workbench_image(image)

container = WorkbenchContainer(image=image, user=1000, group_add=[0],
sysctls=sysctls,
# because rstudio only prints out errors when TTY is present
# > TTY detected. Printing informational message about logging configuration.
tty=True,
# another rstudio speciality, without this, it gives
# > system error 13 (Permission denied) [path: /opt/app-root/src/.cache/rstudio
# equivalent podman command may include
# > --mount type=tmpfs,dst=/opt/app-root/src,notmpcopyup
# can't use mounts= because testcontainers already sets volumes=
# > mounts=[docker.types.Mount(target="/opt/app-root/src/", source="", type="volume", no_copy=True)],
# can use tmpfs=, keep in mind `notmpcopyup` opt is podman specific
tmpfs={"/opt/app-root/src": "rw,notmpcopyup"},
)
sysctls=sysctls)
try:
try:
container.start()
Expand All @@ -64,7 +52,22 @@ def __init__(
port: int = 8888,
**kwargs,
) -> None:
super().__init__(**kwargs)
defaults = dict(
# because rstudio only prints out errors when TTY is present
# > TTY detected. Printing informational message about logging configuration.
tty=True,
# another rstudio speciality, without this, it gives
# > system error 13 (Permission denied) [path: /opt/app-root/src/.cache/rstudio
# equivalent podman command may include
# > --mount type=tmpfs,dst=/opt/app-root/src,notmpcopyup
# can't use mounts= because testcontainers already sets volumes=
# > mounts=[docker.types.Mount(target="/opt/app-root/src/", source="", type="volume", no_copy=True)],
# can use tmpfs=, keep in mind `notmpcopyup` opt is podman specific
tmpfs={"/opt/app-root/src": "rw,notmpcopyup"},
)
if not kwargs.keys().isdisjoint(defaults.keys()):
raise TypeError(f"Keyword arguments in {defaults.keys()=} are not allowed, for good reasons")
super().__init__(**defaults, **kwargs)

self.port = port
self.with_exposed_ports(self.port)
Expand Down
Loading