Skip to content

Commit 15eeee2

Browse files
committed
RHOAIENG-17257: chore(tests): externalize the default workbench-starting arguments
1 parent f5119a1 commit 15eeee2

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

tests/containers/workbenches/workbench_image_test.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,7 @@ def test_image_entrypoint_starts(self, image: str, sysctls) -> None:
3030
skip_if_not_workbench_image(image)
3131

3232
container = WorkbenchContainer(image=image, user=1000, group_add=[0],
33-
sysctls=sysctls,
34-
# because rstudio only prints out errors when TTY is present
35-
# > TTY detected. Printing informational message about logging configuration.
36-
tty=True,
37-
# another rstudio speciality, without this, it gives
38-
# > system error 13 (Permission denied) [path: /opt/app-root/src/.cache/rstudio
39-
# equivalent podman command may include
40-
# > --mount type=tmpfs,dst=/opt/app-root/src,notmpcopyup
41-
# can't use mounts= because testcontainers already sets volumes=
42-
# > mounts=[docker.types.Mount(target="/opt/app-root/src/", source="", type="volume", no_copy=True)],
43-
# can use tmpfs=, keep in mind `notmpcopyup` opt is podman specific
44-
tmpfs={"/opt/app-root/src": "rw,notmpcopyup"},
45-
)
33+
sysctls=sysctls)
4634
try:
4735
try:
4836
container.start()
@@ -64,7 +52,22 @@ def __init__(
6452
port: int = 8888,
6553
**kwargs,
6654
) -> None:
67-
super().__init__(**kwargs)
55+
defaults = dict(
56+
# because rstudio only prints out errors when TTY is present
57+
# > TTY detected. Printing informational message about logging configuration.
58+
tty=True,
59+
# another rstudio speciality, without this, it gives
60+
# > system error 13 (Permission denied) [path: /opt/app-root/src/.cache/rstudio
61+
# equivalent podman command may include
62+
# > --mount type=tmpfs,dst=/opt/app-root/src,notmpcopyup
63+
# can't use mounts= because testcontainers already sets volumes=
64+
# > mounts=[docker.types.Mount(target="/opt/app-root/src/", source="", type="volume", no_copy=True)],
65+
# can use tmpfs=, keep in mind `notmpcopyup` opt is podman specific
66+
tmpfs={"/opt/app-root/src": "rw,notmpcopyup"},
67+
)
68+
if not kwargs.keys().isdisjoint(defaults.keys()):
69+
raise TypeError(f"Keyword arguments in {defaults.keys()=} are not allowed, for good reasons")
70+
super().__init__(**defaults, **kwargs)
6871

6972
self.port = port
7073
self.with_exposed_ports(self.port)

0 commit comments

Comments
 (0)