fix(workbench): exercise the real SSO login path in test_workbench_login - #634
Merged
Conversation
test_workbench_login skipped whenever auth_provider != "password", so no lane ever verified a Workbench login under SSO/OIDC. Reuse the silent-SSO round-trip workbench_login already implements (and the sign-out scenario already relies on): thread auth_provider, interactive_auth, auth_mode, and workbench_auth_error through the login step, and only strip the pre-loaded IdP session for password auth so SSO deployments keep what the round-trip needs. Closes #602.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The changes reuse the existing, already-shared workbench_login(...) SSO flow and only adjust fixture/step wiring to prevent false-green skips in the SSO CI lane.
Pull request overview
This PR fixes a gap in VIP’s Workbench auth coverage by ensuring test_workbench_login actually executes under SSO/OIDC (instead of skipping), so the mock-idp-e2e lane meaningfully verifies a Workbench login.
Changes:
- Removed the unconditional SSO skip in the “Workbench is accessible…” step so the scenario runs under non-password providers.
- Threaded
auth_provider,interactive_auth,auth_mode, andworkbench_auth_errorinto the login step and delegated toworkbench_login(...)(which already implements the silent SSO round-trip + unproven behavior when it can’t establish a session). - Updated the module’s
pagefixture to stripstorage_stateonly for password auth (keeping IdP storage state intact for SSO/OIDC runs).
File summaries
| File | Description |
|---|---|
| src/vip_tests/workbench/test_auth.py | Stops skipping under SSO and routes the login scenario through the shared workbench_login SSO-capable path while preserving storage state for IdP-backed auth. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
workbench_login's fast path only checked for the homepage's own chrome, so a valid session cookie that redirects straight into a running session's IDE view (as CI's mock-idp-e2e lane just proved happens under --headless-auth) was invisible to it. It fell through to the password-form retry loop and failed with "Login failed after 3 attempts" despite the user being authenticated the whole time. Handle it the same way test_sessions.py already does when navigating back from a session: detect "/s/" in the URL and go to /home.
Temporary instrumentation to see why the /s/-detection fix for #602 didn't resolve the mock-idp-e2e failure. Not for merge.
print() doesn't survive VIP's custom terminal reporter (no "Captured stdout" section appears even on failure). Accumulate the debug trail and put it directly in the AssertionError text instead, since that renders in full every time.
rstudio/rstudio-workbench:latest hasn't updated since 2022-08-19 (a pre-Posit-rebrand build with no #posit-logo element), while jammy rolls forward with every release and was current as of yesterday. Use jammy for the release leg instead, so it actually tracks newest without a manual bump. Also drops the DEBUG_602 diagnostic instrumentation added while investigating this -- its job is done.
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_workbench_loginskipped wheneverauth_provider != "password", so the mock-idp-e2e lane's only Workbench test never actually ran under SSO/OIDC — the job reported green on a skip.workbench_login()inconftest.pyalready implements a real SSO path: a silent SSO round-trip against the pre-loaded IdP session under--headless-auth/--interactive-auth, correctly reportingunproven(not a false pass) if that round-trip fails. The sign-out scenario in this same file already uses this path successfully.This reuses that same path for the login scenario instead of adding new machinery:
workbench_accessible.auth_provider,interactive_auth,auth_mode,workbench_auth_errorthroughnavigate_and_loginintoworkbench_login(...), matching howwb_loginalready calls it.storage_statefor password auth, so SSO deployments keep the IdP session the silent round-trip needs.Verified:
ruff check/format --checkpass,mypyclean (informational —src/vip_tests/isn't in CI's mypy scope), andpytest --collect-onlyconfirms pytest-bdd resolves the new step/fixture signatures with no missing-fixture errors. Live SSO verification happens in CI's mock-idp-e2e lane.Closes #602.
Two other real bugs turned up along the way, fixed here too since they blocked verifying the fix above:
workbench_login's "already logged in" fast path only recognized the homepage's own chrome (#posit-logo); a valid session cookie that lands directly in a running session's IDE view was invisible to it and fell through to a doomed password-form retry. Now falls back to/home(same patterntest_sessions.pyalready uses).mock-idp-e2e's release leg pinned Workbench torstudio/rstudio-workbench:latest, a Docker Hub tag stale since 2022-08-19 (pre-Posit-rebrand, no#posit-logoat all). Switched tojammy, which rolls forward with every release.