Skip to content

Commit

Permalink
🎨 [e2e]: Increase S4L's timeout when there is a workspace to download (
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored Sep 10, 2024
1 parent 891312a commit 2be918d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
_EC2_STARTUP_MAX_WAIT_TIME + _S4L_DOCKER_PULLING_MAX_TIME + _S4L_MAX_STARTUP_TIME
)
_S4L_STARTUP_SCREEN_MAX_TIME: Final[int] = 45 * SECOND

_S4L_COPY_WORKSPACE_TIME: Final[int] = 60 * SECOND

@dataclass(kw_only=True)
class S4LWaitForWebsocket:
Expand Down Expand Up @@ -84,7 +84,7 @@ def __call__(self, message: str) -> bool:
return False


def launch_S4L(page: Page, node_id, log_in_and_out: WebSocket, autoscaled: bool) -> Dict[str, Union[WebSocket, FrameLocator]]:
def launch_S4L(page: Page, node_id, log_in_and_out: WebSocket, autoscaled: bool, copy_workspace: bool = False) -> Dict[str, Union[WebSocket, FrameLocator]]:
with log_context(logging.INFO, "launch S4L") as ctx:
predicate = S4LWaitForWebsocket(logger=ctx.logger)
with page.expect_websocket(
Expand All @@ -95,6 +95,11 @@ def launch_S4L(page: Page, node_id, log_in_and_out: WebSocket, autoscaled: bool)
if autoscaled
else _S4L_MAX_STARTUP_TIME
)
+ (
_S4L_COPY_WORKSPACE_TIME
if copy_workspace
else 0
)
+ 10 * SECOND,
) as ws_info:
s4l_iframe = wait_for_service_running(
Expand All @@ -105,6 +110,11 @@ def launch_S4L(page: Page, node_id, log_in_and_out: WebSocket, autoscaled: bool)
_S4L_AUTOSCALED_MAX_STARTUP_TIME
if autoscaled
else _S4L_MAX_STARTUP_TIME
)
+ (
_S4L_COPY_WORKSPACE_TIME
if copy_workspace
else 0
),
press_start_button=False,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e-playwright/tests/sim4life/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_template(
node_ids: list[str] = list(project_data["workbench"])
assert len(node_ids) == 1, "Expected 1 node in the workbench!"

resp = launch_S4L(page, node_ids[0], log_in_and_out, autoscaled)
resp = launch_S4L(page, node_ids[0], log_in_and_out, autoscaled, copy_workspace=True)
s4l_websocket = resp["websocket"]
s4l_iframe = resp["iframe"]
interact_with_S4L(page, s4l_iframe)
Expand Down

0 comments on commit 2be918d

Please sign in to comment.