chore(workbenches): reduce the workbench spawn timeout to 2mins#1179
chore(workbenches): reduce the workbench spawn timeout to 2mins#1179dbasunag merged 2 commits intoopendatahub-io:mainfrom
Conversation
2 minutes should be enough; this helps to reduce the test execution time in cases where the spawning fails
|
The following are automatically added/executed:
Available user actions:
Supported labels{'/cherry-pick', '/build-push-pr-image', '/verified', '/hold', '/wip', '/lgtm'} |
📝 WalkthroughWalkthroughTwo test parameterizations in a notebook controller spawning test module were updated to use a shorter timeout constant (TIMEOUT_2MIN instead of TIMEOUT_5MIN). No logic, control flow, or test structure changes were made; only the timeout duration values differ. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/workbenches/notebook-controller/test_spawning.py (1)
80-102: Assertions will raiseKeyErrorif resource keys are missing.If
resources.requestsorresources.limitsisNone, or if the expected keys (cpu,memory) are absent, the test fails with an unhelpfulKeyError/TypeErrorrather than an assertion message. Consider defensive access with.get()or explicit presence checks.Defensive check pattern
- assert auth_container.resources.requests["cpu"] == "200m", ( + requests = auth_container.resources.requests or {} + assert requests.get("cpu") == "200m", ( f"Expected CPU request '200m', got '{auth_container.resources.requests['cpu']}'" )Apply similar pattern for each resource assertion.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/workbenches/notebook-controller/test_spawning.py` around lines 80 - 102, The assertions access auth_container.resources.requests and .limits keys directly causing KeyError/TypeError when requests/limits or cpu/memory are missing; update the test around _get_auth_container and notebook_pod to first assert that auth_container.resources is not None and that resources.requests and resources.limits are dict-like, then use .get("cpu")/.get("memory") (or safe dict access) for each check and assert the returned value equals the expected string with a clear message (e.g., "Auth container cpu request missing" or "Expected CPU request '200m', got '...'" ) so failures produce informative assertion messages instead of KeyError.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/workbenches/notebook-controller/test_spawning.py`:
- Line 25: The timeout for notebook pod spawning is set to Timeout.TIMEOUT_2MIN
which is too short compared to the fixture's default pod_ready_timeout
(Timeout.TIMEOUT_10MIN); locate the {"timeout": Timeout.TIMEOUT_2MIN} usage in
tests/workbenches/notebook-controller/test_spawning.py (and the duplicate at the
other occurrence) and either revert it to Timeout.TIMEOUT_10MIN or make it read
from the pod_ready_timeout fixture/config so the test uses the same, validated
spawn timeout; run CI/locally to measure actual spawn durations and document the
chosen minimum timeout in a comment or test docstring.
---
Nitpick comments:
In `@tests/workbenches/notebook-controller/test_spawning.py`:
- Around line 80-102: The assertions access auth_container.resources.requests
and .limits keys directly causing KeyError/TypeError when requests/limits or
cpu/memory are missing; update the test around _get_auth_container and
notebook_pod to first assert that auth_container.resources is not None and that
resources.requests and resources.limits are dict-like, then use
.get("cpu")/.get("memory") (or safe dict access) for each check and assert the
returned value equals the expected string with a clear message (e.g., "Auth
container cpu request missing" or "Expected CPU request '200m', got '...'" ) so
failures produce informative assertion messages instead of KeyError.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: e977b3e3-0c9c-4dee-87c7-ec3b23107fb2
📒 Files selected for processing (1)
tests/workbenches/notebook-controller/test_spawning.py
|
Status of building tag latest: success. |
2 minutes should be enough; this helps to reduce the test execution time in cases where the spawning fails
Pull Request
Summary
Related Issues
How it has been tested
Additional Requirements
Summary by CodeRabbit