Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sh/refresh sandbox #973

Merged
merged 8 commits into from
Feb 27, 2024
Merged

Sh/refresh sandbox #973

merged 8 commits into from
Feb 27, 2024

Conversation

shetzel
Copy link
Contributor

@shetzel shetzel commented Feb 26, 2024

What does this PR do?

Adds a new command to refresh a sandbox.
Adds tests for the command.

What issues does this PR fix or reference?

@W-15042183@

NOTE: requires forcedotcom/sfdx-core#1031

Testing suggestions:

  • don't provide a sandbox name -> should error
  • don't provide a prod org -> should error
  • provide a sandbox name that doesn't exist -> should error
  • provide a sandbox name with the flag and a definition file -> should warn and use the sandbox name from the flag
  • refresh with —async -> should suggest a resume command and have a cache entry
  • refresh with -w 1 -> should timeout and suggest a resume command and have a cache entry
  • resume with -w 1 -> should resume. If the refresh was already complete it should auth. If not it might timeout again.
  • refresh with -w 180 -> should poll for updates and auth when complete.

If you run org list when a sandbox has completed refreshing but the CLI hasn't authed to the sandbox after the refresh, it will report some auth error. You have to resume the sandbox refresh and have it auth for the org list to be successful.

@shetzel shetzel requested a review from a team as a code owner February 26, 2024 19:51
@mdonnalley
Copy link
Contributor

Setup: Pulled sfdx-core branch, linked into this branch and linked to sf

✅ don't provide a sandbox name -> should error
✅ don't provide a prod org -> should error
✅ provide a sandbox name that doesn't exist -> should error
✅ provide a sandbox name with the flag and a definition file -> should warn and use the sandbox name from the flag
✅ refresh with —async -> should suggest a resume command and have a cache entry

❯ sf org refresh sandbox -n sbxgs01 -o [email protected] --async
 ›   Warning: @salesforce/plugin-org is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used
 ›   instead.
=== Config Sandbox Refresh

 Field            Value
 ──────────────── ────────────────────────────
 Id               0GQ1Q0000004iQ8WAI
 SandboxName      sbxgs01
 LicenseType      DEVELOPER
 TemplateId       null
 HistoryDays      0
 CopyChatter      false
 AutoActivate     true
 ApexClassId      null
 Description      null
 SourceId         null
 IsDeleted        false
 CreatedDate      2024-02-16T17:06:19.000+0000
 CreatedById      005B0000004TiUpIAK
 LastModifiedDate 2024-02-21T19:02:32.000+0000
 LastModifiedById 005B0000004TiUpIAK
? Is the configuration correct? yes
 Field         Value
 ───────────── ────────────────────────────
 Id            0GR1Q0000004knIWAQ
 SandboxName   sbxgs01
 Status        Pending
 LicenseType   DEVELOPER
 SandboxInfoId 0GQ1Q0000004iQ8WAI
 Created Date  2024-02-26T22:41:13.000+0000
 CopyProgress  0%
---------------------
Sandbox Refresh Stages
… - Pending
… - Processing
… - Activating
… - Authenticating
Run "sf org resume sandbox --job-id 0GR1Q0000004knIWAQ -o [email protected]" to check for status.
If the org is ready, checking the status also authorizes the org for use with Salesforce CLI.

✅ resume with -w 1 -> should resume and timeout again if not completed

✅ refresh with -w 180 -> should poll for updates and auth when complete.
✅ resume with -w 1 -> should resume and auth if already completed

❯ sf org resume sandbox --job-id 0GR1Q0000004knIWAQ -o [email protected] -w 1
 ›   Warning: @salesforce/plugin-org is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used
 ›   instead.

=== Sandbox Org Create/Refresh Status

 Field         Value
 ───────────── ────────────────────────────
 Id            0GR1Q0000004knIWAQ
 SandboxName   sbxgs01
 Status        Completed
 LicenseType   DEVELOPER
 SandboxInfoId 0GQ1Q0000004iQ8WAI
 Created Date  2024-02-26T22:41:13.000+0000
 CopyProgress  100%
 SandboxOrg    00D3I0000008poX
---------------------
Sandbox Create/Refresh Stages
✓ - Pending
✓ - Processing
✓ - Activating
✓ - Authenticating
The sandbox org create/refresh was successful.
The username for the sandbox is [email protected].
You can open the org by running "sf org open -o [email protected]"
Resume Create... done

⚠️ is Resume Create the right message for the spinner? Should it be either Resume or Create?

@shetzel shetzel merged commit 9fa1985 into main Feb 27, 2024
12 checks passed
@shetzel shetzel deleted the sh/refresh-sandbox branch February 27, 2024 23:27
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.

3 participants