Skip to content
Merged
Changes from 1 commit
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
16 changes: 13 additions & 3 deletions tests/containers/kubernetes_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,22 @@ def deploy(

self.port = p.get_actual_port()
LOGGER.debug(f"Listening on port {self.port}")
# Use 120s timeout for slower cold starts (e.g. code-server on arm64).

# Use TIMEOUT_2MIN for slower cold starts (e.g. code-server on arm64).
# Always probe / (not /api): RStudio's nginx redirects /api to a
# hardcoded http://127.0.0.1:8888/api/, which is wrong (and unreachable)
# through a port-forward where the local port isn't literally 8888.
# https://github.com/red-hat-data-services/notebooks/issues/2684
def _ready() -> bool:
with requests.Session() as session:
response = session.get(f"http://127.0.0.1:{self.port}/", timeout=5, allow_redirects=True)
return response.status_code == 200

Wait.until(
"Connecting to pod succeeds",
1,
120,
lambda: requests.get(f"http://127.0.0.1:{self.port}/api", timeout=10).status_code == 200,
TestFrameConstants.TIMEOUT_2MIN,
_ready,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
)
LOGGER.debug("Done setting up portforward")

Expand Down
Loading