Skip to content

Move the interactive device code login tests to the terminal emulator - #7222

Closed
maksim-zuev-db wants to merge 5 commits into
device-code-split-stepsfrom
device-code-interactive-tests
Closed

maksim-zuev-db wants to merge 5 commits into
device-code-split-stepsfrom
device-code-interactive-tests

Conversation

@maksim-zuev-db

Copy link
Copy Markdown
Member

Stacked on #7217.

Changes

The interactive device code login is now tested with termtest against the fake server, instead of acceptance tests that pipe the confirmation code into stdin. The device-code/nominal and device-code/wrong-code acceptance tests are removed. No production code changes.

Why

Users type the confirmation code into a terminal, and the upcoming non-interactive login (#7220) takes over when stdin is not a terminal, so the piped tests would stop testing the interactive flow.

Tests

The new tests cover re-entering a wrong or blank code, running out of attempts, closed input, the stored token, and the scopes of the device authorization request.

This pull request and its description were written by Isaac.

maksim-zuev-db and others added 2 commits October 28, 2026 11:56
Export RequestDeviceAuthorization and ExchangeDeviceCode so a login can be
completed by a separate command, and rebuild DeviceCodeChallenge on top of
them. Rejected codes now match ErrInvalidConfirmationCode or
ErrInvalidDeviceCode, so callers no longer compare the server's description.
Export NormalizeCode so that callers can compare codes the way the user
enters them.

Co-authored-by: Isaac <no-reply@databricks.com>
RequestDeviceAuthorization errors already say which step failed, and
DeviceCodeChallenge adds the same prefix to its token exchange errors.

Co-authored-by: Isaac <no-reply@databricks.com>
maksim-zuev-db and others added 2 commits October 28, 2026 14:25
Co-authored-by: Isaac <no-reply@databricks.com>
The acceptance tests of the interactive device code login pipe the
confirmation code into stdin, while users type it into a terminal. Run the
login in the terminal emulator against the fake server instead. The tests
cover re-entering a wrong or blank code, running out of attempts, closed
input, the stored token, and the scopes of the device authorization request.

Co-authored-by: Isaac <no-reply@databricks.com>
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: bcf2f96

Run: 40709162375

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 281 15 5:25
✅​ aws-windows-latest-4core-16gb 283 13 3:52
✅​ azure linux-2core-8gb 280 15 5:42
✅​ azure-windows-latest-4core-16gb 282 13 3:39
✅​ gcp linux-2core-8gb 281 15 6:00
✅​ gcp-windows-latest-4core-16gb 283 13 3:41
Top 6 slowest tests (at least 2 minutes):
duration env testname
3:59 azure linux-2core-8gb TestAccept
3:45 gcp linux-2core-8gb TestAccept
3:41 aws linux-2core-8gb TestAccept
3:36 gcp-windows-latest-4core-16gb TestAccept
3:34 azure-windows-latest-4core-16gb TestAccept
3:33 aws-windows-latest-4core-16gb TestAccept

@maksim-zuev-db
maksim-zuev-db force-pushed the device-code-interactive-tests branch from 1d574cc to fc8cd8d Compare October 28, 2026 14:35
Check the host, workspace ID, auth type and scopes of the saved profile
instead of matching auth_type in the raw file. The scopes test now
starts from an empty config with --host, so creating a profile from the
flag is covered too. Clear the environment so DATABRICKS_* variables of
the developer don't end up in the saved profile.

Co-authored-by: Isaac <no-reply@databricks.com>
@maksim-zuev-db
maksim-zuev-db removed this pull request from stack #7223 October 28, 2026 15:48
@maksim-zuev-db
maksim-zuev-db removed this pull request from stack #7236 October 28, 2026 15:57
@maksim-zuev-db
maksim-zuev-db marked this pull request as ready for review October 28, 2026 16:00
@maksim-zuev-db
maksim-zuev-db requested review from a team as code owners October 28, 2026 16:00
@maksim-zuev-db
maksim-zuev-db force-pushed the device-code-split-steps branch from 113e772 to 74b6992 Compare October 29, 2026 12:15
@maksim-zuev-db
maksim-zuev-db removed this pull request from stack #7237 October 29, 2026 12:22
@maksim-zuev-db
maksim-zuev-db deleted the device-code-interactive-tests branch October 29, 2026 12:23
@maksim-zuev-db

Copy link
Copy Markdown
Member Author

Folded into #7220. The interactive login tests move to the terminal emulator in the same PR as the non-interactive login, because that is the change that stops piped stdin from testing the interactive flow. Until then, the refactoring in #7217 keeps the acceptance tests.

This comment was written by Isaac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants