Skip to content

Test sync option builders without a root command - #7485

Open
pietern wants to merge 1 commit into
mainfrom
sync-options-values
Open

pietern wants to merge 1 commit into
mainfrom
sync-options-values

Conversation

@pietern

@pietern pietern commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Changes

databricks sync and databricks bundle sync build their options from a *cobra.Command, so their tests created a full root command with root.New() to get there. The builders now take only what they use: the context, output type, stdout, and args or bundle. The tests call them directly.

The two-argument check moves into RunE, and the builder returns a plain error for a wrong number of args. A new acceptance test covers sync with zero, one, and three arguments. Since the unit tests can no longer check that the root's --output reaches sync, the dry-run acceptance test now runs it with -o json.

This reduces usage of root.New() ahead of making it private later in this stack.

Tests

Unit tests for both builders; new acceptance test acceptance/cmd/sync-wrong-args; a JSON case in acceptance/cmd/sync/dryrun.

This pull request and its description were written by Isaac.

@pietern
pietern requested review from a team as code owners November 11, 2026 16:37
@pietern
pietern added this pull request to stack #7488 November 11, 2026 16:37
@github-actions github-actions Bot added the DABs DABs related issues label Nov 11, 2026
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Commit: c9f6c24db | Workflow run

Regression test report

Selected 2 changed tests (limit=20, 0 not selected)

2 tests: regression=0 unreleased=0 coverage=2 failing=0
test branch main (eef3b54) latest (v1.26.0)
TestAccept/cmd/sync-wrong-args ✅ ✅ ✅
TestAccept/cmd/sync/dryrun ✅ ✅ ✅

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: c9f6c24

Run: 43421234972

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 270 17 8:15
💚​ aws-windows-latest-4core-16gb 1 272 15 5:31
💚​ azure linux-2core-8gb 1 269 17 7:32
💚​ azure-windows-latest-4core-16gb 1 271 15 4:36
💚​ gcp linux-2core-8gb 1 270 17 9:18
💚​ gcp-windows-latest-4core-16gb 1 272 15 6:36
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:14 gcp linux-2core-8gb TestAccept
3:50 aws linux-2core-8gb TestAccept
3:49 azure linux-2core-8gb TestAccept
3:43 azure-windows-latest-4core-16gb TestAccept
3:42 gcp-windows-latest-4core-16gb TestAccept
2:53 aws-windows-latest-4core-16gb TestAccept

@pietern
pietern force-pushed the sync-options-values branch 2 times, most recently from 7417e19 to 76a7f2e Compare November 12, 2026 13:51
The sync and bundle sync option builders took the command only to read
its context, output type, and stdout. Pass those instead, so their tests
no longer attach the command to root.New() to resolve the root flags.
The argument count check stays in RunE; its cases move to the
sync-without-args acceptance test.

Co-authored-by: Isaac <no-reply@databricks.com>
@pietern
pietern force-pushed the sync-options-values branch from 76a7f2e to c9f6c24 Compare November 13, 2026 11:55

This branch has not been deployed

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

Labels

DABs DABs related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants