Skip to content

acceptance: extend cmd/lakebox tests to cover write-path commands#5476

Merged
akshaysingla-db merged 1 commit into
databricks:demo-lakeboxfrom
akshaysingla-db:akshay/lakebox-acceptance-tests-2
Jun 8, 2026
Merged

acceptance: extend cmd/lakebox tests to cover write-path commands#5476
akshaysingla-db merged 1 commit into
databricks:demo-lakeboxfrom
akshaysingla-db:akshay/lakebox-acceptance-tests-2

Conversation

@akshaysingla-db

Copy link
Copy Markdown
Collaborator

Summary

Second batch of lakebox acceptance tests, following #5474. Covers 14 leaf scenarios on the write/connection-path commands and JSON output shapes that weren't in the first batch.

Test What it locks down
list/json -o json shape (no FQDN field, gatewayHost present, idleTimeout serialized as Duration string)
status/running Happy-path text output with all rendered fields
status/json JSON shape — verifies the FQDN-removal in #5460 didn't get reverted
ssh-key/list/with-entries Multi-row table including unnamed key falling back to (unset)
ssh-key/delete/success DELETE wire route + confirmation message
delete/success Happy path with --auto-approve to bypass the prompt
delete/not-found 404 → friendly no lakebox named X (the consistency fix from #5460)
delete/no-tty-no-auto-approve Non-interactive context fast-fails pointing at the --auto-approve flag
default/set Set default → confirmation message
default/not-found 404 → friendly error (same message as delete)
start/already-running API returns Running → CLI short-circuits with "Already running X" (skips waitForRunning)
stop/success Happy path with refreshed status
config/update-name PATCH wire route + post-update output rendering
create/with-name POST wire route + stdout ID + default-set side effect

Two test-infrastructure additions

  1. acceptance/cmd/lakebox/script.prepare sets HOME=$TEST_TMP_DIR so each test's ~/.databricks/lakebox.json is isolated. Without this, parallel lakebox tests race each other writing to the shared HOME-rooted state file and one read sees the other's half-written content. Auth is unaffected — the framework passes DATABRICKS_HOST / DATABRICKS_TOKEN explicitly via env, so the CLI doesn't fall back to ~/.databrickscfg.

  2. EnvMatrix.DATABRICKS_BUNDLE_ENGINE = [] in the parent test.toml overrides the root matrix to skip the per-engine variants. Lakebox is engine-independent and running both variants in parallel was the original symptom of the HOME race.

Two of the ssh-key tests also pin the test key hash via a high-priority [[Repls]] entry so the framework's default 3+-digit-run → [NUMID] regex doesn't shred it mid-hash.

Test plan

  • go test ./acceptance -run TestAccept/cmd/lakebox — all 20 tests pass (6 from acceptance: add cmd/lakebox tests #5474 + 14 new)
  • ./task lint clean
  • Re-running with -update and then without is idempotent (no drift)

Still out of scope

  • register — generates and reads real SSH keys via ssh-keygen; needs a heavier fixture / process stub
  • sshexecvs into ssh; not testable through this framework

This pull request and its description were written by Isaac.

Adds 14 leaf scenarios covering the rest of the lakebox subcommand
surface beyond the read-path / error-path tests landed in databricks#5474:

  list/json
  status/running
  status/json
  ssh-key/list/with-entries
  ssh-key/delete/success
  delete/success            (with --auto-approve)
  delete/not-found          (verifies friendly 404 message)
  delete/no-tty-no-auto-approve   (verifies fast-fail with flag pointer)
  default/set
  default/not-found
  start/already-running
  stop/success
  config/update-name
  create/with-name

Each test stubs the relevant API endpoint(s) and asserts the rendered
output. Two of the ssh-key tests pin the test key hash via a
high-priority [[Repls]] entry so the framework's default 3+-digit-run
→ [NUMID] regex doesn't shred it mid-hash.

Two test-infrastructure additions at the lakebox parent level:

- `script.prepare` sets `HOME=$TEST_TMP_DIR` so each test's
  ~/.databricks/lakebox.json is isolated. Without this, parallel tests
  race each other writing to the shared HOME-rooted state file and
  one read sees the other's half-written content. Auth is unaffected
  because the framework passes DATABRICKS_HOST/TOKEN explicitly.
- `EnvMatrix.DATABRICKS_BUNDLE_ENGINE = []` overrides the root matrix
  to skip the per-engine variants. Lakebox is engine-independent and
  running both variants in parallel was the original symptom of the
  HOME race.

All 20 lakebox acceptance tests (6 prior + 14 new) pass cleanly.
./task lint clean.

Co-authored-by: Isaac
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

Could not determine reviewers from git history.
Round-robin suggestion: @anton-107

Eligible reviewers: @andrewnester, @anton-107, @denik, @pietern, @renaudhartert-db, @shreyas-goenka, @simonfaltum

Suggestions based on git history. See OWNERS for ownership rules.

@akshaysingla-db akshaysingla-db merged commit 576f9ca into databricks:demo-lakebox Jun 8, 2026
13 of 20 checks passed
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.

1 participant