Skip to content

Comments

feat(organization): add --workspace-id flag to org switch for non-interactive use#1938

Merged
ronidelacruz-astro merged 4 commits intomainfrom
feat/org-switch-workspace-id
Sep 18, 2025
Merged

feat(organization): add --workspace-id flag to org switch for non-interactive use#1938
ronidelacruz-astro merged 4 commits intomainfrom
feat/org-switch-workspace-id

Conversation

@ronidelacruz-astro
Copy link
Contributor

@ronidelacruz-astro ronidelacruz-astro commented Sep 16, 2025

Description

Add --workspace-id (-w) to astro organization switch to allow non-interactive workspace switching after changing org.

🎟 Issue(s)

Related #1805

🧪 Functional Testing

  • astro organization switch → still prompts if multiple workspaces.
  • astro organization switch --workspace-id → switches org and workspace without prompt.
  • Verified via unit tests (TestOrganizationSwitch).

📸 Screenshots

Add screenshots to illustrate the validity of these changes.

📋 Checklist

  • Rebased from the main (or release if patching) branch (before testing)
  • Ran make test before taking out of draft
  • Ran make lint before taking out of draft
  • Added/updated applicable tests
  • Tested against Astro-API (if necessary).
  • Tested against Houston-API and Astronomer (if necessary).
  • Communicated to/tagged owners of respective clients potentially impacted by these changes.
  • Updated any related documentation

@ronidelacruz-astro ronidelacruz-astro force-pushed the feat/org-switch-workspace-id branch from cafceeb to ee1e8d8 Compare September 17, 2025 00:17
@coveralls-official
Copy link

coveralls-official bot commented Sep 17, 2025

Pull Request Test Coverage Report for Build 5b29ce7e-0441-423c-8be4-a1fa665a5b46

Details

  • 8 of 9 (88.89%) changed or added relevant lines in 1 file are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.005%) to 38.156%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/cloud/organization.go 8 9 88.89%
Files with Coverage Reduction New Missed Lines %
docker/docker.go 3 44.68%
Totals Coverage Status
Change from base Build 42bc03c2-4a36-4e44-85a2-07e420cfe624: 0.005%
Covered Lines: 23774
Relevant Lines: 62308

💛 - Coveralls

@ronidelacruz-astro ronidelacruz-astro force-pushed the feat/org-switch-workspace-id branch from 52db661 to 61a0e7b Compare September 17, 2025 14:14
Copy link
Contributor

@ianbuss ianbuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of nits but otherwise looks good!

_, err := execOrganizationCmd(cmdArgs...)
assert.NoError(t, err)
origOrgSwitch := orgSwitch
orgSwitch = func(orgName string, coreClient astrocore.CoreClient, platformCoreClient astroplatformcore.CoreClient, out io.Writer, shouldDisplayLoginLink bool) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is an existing pattern in this code base but this is unlikely to be "safe" for parallel test runs if we were to ever use those. Might be worth just adding a comment to that effect. You've done the right thing here @ronidelacruz-astro by adding the defer function to put the function back at the end of this test, which looks like it's missing from other tests.

Copy link
Member

@feluelle feluelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I would also have commented the same nit as Ian about the inline err check.

@ronidelacruz-astro ronidelacruz-astro merged commit 29d1c7e into main Sep 18, 2025
5 of 6 checks passed
@ronidelacruz-astro ronidelacruz-astro deleted the feat/org-switch-workspace-id branch September 18, 2025 15:21
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.

Support providing workspace id on organization switch

3 participants