Skip to content

acc: cover tag limits, SQL execution and telemetry upload on cloud, drop the integration equivalents - #8072

Merged
denik merged 5 commits into
mainfrom
intdep-backend-libs
Nov 30, 2026
Merged

denik merged 5 commits into
mainfrom
intdep-backend-libs

Conversation

@denik

@denik denik commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Replaces 10 integration tests in integration/libs/{tags,telemetry,sqlexec} with acceptance tests that run locally and, for the backend facts, on every cloud (Cloud = true):

deleted integration test verdict now covered by
TestTagKeyAWS, TestTagValueAWS PORTED workspace/jobs/tag-limits (aws table)
TestTagKeyAzure, TestTagValueAzure PORTED workspace/jobs/tag-limits (azure table)
TestTagKeyGCP, TestTagValueGCP PORTED workspace/jobs/tag-limits (gcp table)
TestTelemetryEndpoint PORTED telemetry/upload-cloud
TestSQLExecColumnsAndRows PORTED experimental/aitools/tools/query/columns-rows
TestSQLExecParameters PORTED experimental/aitools/tools/query/parameters
TestSQLExecSubmitAndCancel PORTED experimental/aitools/tools/statement/submit-cancel

New acceptance tests:

  • workspace/jobs/tag-limits: jobs create with the same tag keys and values as the integration tests, using the same job shape (a Python task on a new cluster, never run). On cloud the script checks each rejection message against a per-cloud table: the patterns and max lengths libs/tags normalizes bundle tags to. Accepted tags are read back with jobs get. The testserver does not validate tags, so the local run injects the rejections with fault.py --body-contains. Every created job is deleted on exit.
  • telemetry/upload-cloud: the raw /telemetry-ext response to two test events (api post; errors: [], numProtoSuccess: 2), then selftest send-telemetry through the CLI's own upload path ("All 2 logs uploaded successfully"). Like the integration test, it skips when the workspace keeps throttling /telemetry-ext (a terminal 429).
  • experimental/aitools/tools/query/{scalar,columns-rows,parameters,null-parameter,failed-statement} and statement/submit-cancel: the libs/sqlexec facts through the commands that ship it (result columns in order, rows, INT/STRING/NULL parameters on the wire and in the result, FAILED error code/class/SQLSTATE, submit -> cancel -> CANCELED). Each query test also pins the statement (and parameters) the CLI sent. Locally the query dirs stub the warehouse's response; submit-cancel uses the testserver's SQL fake, which tracks the statement and its cancellation. On cloud they skip on non-UC workspaces or without a warehouse, like the integration tests (TEST_METASTORE_ID, TEST_DEFAULT_WAREHOUSE_ID).
  • pipelines/show/failed-statement (local): the failed-statement branch of sqlexec.Execute, whose only caller is pipelines show.

Also removes testutil.Require and Cloud.Verify: the tags tests were their only callers.

Not in this PR: TestSQLExecScalar, TestSQLExecNullParameter and TestSQLExecFailedStatement stay in place. Their facts are ported above, but each has something no command reaches: ExecuteScalar/Result.Scalar have no production caller, and no command reads StatementError.SQLState. Whether to drop them is a maintainer decision.

Why

The integration tree is deprecated (integration/README.md): cloud coverage moves to acceptance tests with Cloud = true, which also run against the testserver on every PR. Same method as #6113, #6140, #6223, #6316 and #7251.

Coverage proof

Each integration test's coverage was recorded on AWS with -coverpkg=github.com/databricks/cli/..., one passing run per test. It was compared block by block with the acceptance coverage: a full local run at the base commit, plus local and AWS runs of the new tests. The Azure/GCP tag tests skip on AWS. They call only the SDK and harness code (no product blocks), and their facts are checked by the azure and gcp tables of tag-limits on this PR's cloud run.

integration test verdict blocks run covered by acceptance harness-only acceptance tests
TestTagKeyAWS PORTED 53 29 24 workspace/jobs/tag-limits
TestTagValueAWS PORTED 53 29 24 workspace/jobs/tag-limits
TestTelemetryEndpoint PORTED 43 29 14 telemetry/upload-cloud
TestSQLExecColumnsAndRows PORTED 75 61 14 query/columns-rows, pipelines/show/*
TestSQLExecParameters PORTED 78 64 14 query/parameters, statement/submit-cancel
TestSQLExecSubmitAndCancel PORTED 72 58 14 statement/submit-cancel, query/failed-statement

"Harness" blocks are integration/internal/acc and internal/testutil: the integration tests' own setup. No real-gap blocks remain for the deleted tests.

Assertion map
integration test (BASE) fact acceptance check where
TestTagKey{AWS,Azure,GCP} invalid key outside the cloud's pattern rejected with "The key must match the regular expression ." tag-limits "key with characters outside the pattern: rejected" (message checked against the cloud's table) cloud, per cloud
TestTagKey*/TestTagValue* unicode "🍎" rejected: "contains non-latin1 characters." tag-limits cloud, all
TestTagKey* empty empty key rejected: "minimal length is 1, and the maximum length is 127/512/63." tag-limits "empty key" cloud, per cloud
TestTagKey*/TestTagValue* valid "cafe" accepted tag-limits "accepted, stored tags: ..." both
TestTagValueAWS/GCP invalid value "café" rejected with the value pattern tag-limits "value café: ..." (Azure: accepted, the job is created) cloud, per cloud
tags cleanup created jobs are deleted tag-limits trap deletes every created job both
TestTelemetryEndpoint POST /telemetry-ext succeeds, numProtoSuccess 2, errors empty upload-cloud raw step: "errors": [], "numProtoSuccess": 2; CLI upload: "All 2 logs uploaded successfully" both
TestTelemetryEndpoint 429 a 429 that outlasts the SDK retries skips upload-cloud: SKIP_TEST when the failed upload shows a 429, in both steps cloud
TestSQLExecColumnsAndRows columns id, doubled in order; rows 0,0 / 1,2 / 2,4 query/columns-rows csv output both
TestSQLExecParameters INT 42 and STRING hello bound query/parameters: wire parameters and result row both
TestSQLExecSubmitAndCancel submit returns an id at once; cancel succeeds; poll ends CANCELED with an error statement/submit-cancel: PENDING + id, cancel request for that id, get -> CANCELED with error, exit 1; SUCCEEDED (cancel too late) skips both

Runtime

Integration tests replaced (AWS): about 1-2s each, about 12s in total (the tag subtests run in parallel). Added acceptance tests on cloud: tag-limits about 9s, upload-cloud about 2s, the six SQL dirs 3-5s each, run in parallel. Locally all ten new dirs take a few seconds.

Judgment calls

  • tag-limits checks messages only on cloud. A local run cannot check a backend fact, so it injects the rejections and requires the injected message. Extending the testserver to validate tags per cloud would be a bigger change.
  • The query dirs use per-dir [[Server]] stubs because acceptance tests can't register statements in the testserver's SQL engine. The cloud run pins the real responses.
  • submit-cancel pins the CANCELED outcome. If the statement finished before the cancel landed (the integration test accepted SUCCEEDED), the test skips: there is nothing left to check.
  • tag-limits keeps fault.py for the local rejections, and the query tests keep [[Server]] stubs: validating tags in the testserver's jobs handler, and registering SQL matchers from test.toml, are libs/testserver or runner changes for follow-up PRs. Until then the local runs check what the CLI sends, and the cloud runs check the backend's answers.

Gaps and risks

  • Azure and GCP: the new tests ran locally and on AWS; Azure and GCP run through this PR's cloud: line (see the Integration test report).
  • Risk: low (test-only; no product code changes).

Dashboard

No dashboard errors are fixed by this PR.

This PR was created by the integration-deprecation loop.

🤖 AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

@github-actions github-actions Bot added aitools AI tools (databricks aitools) related changes test-only-fix PRs that update failing of flaky tests without changing CLI code. labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: 97d721b77 | Workflow run

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

9 tests: regression=0 unreleased=0 coverage=9 failing=0
test branch main (7bd649e) latest (v1.28.0)
TestAccept/experimental/aitools/tools/query/columns-rows ✅ ✅ ✅
TestAccept/experimental/aitools/tools/query/failed-statement ✅ ✅ ✅
TestAccept/experimental/aitools/tools/query/null-parameter ✅ ✅ ✅
TestAccept/experimental/aitools/tools/query/parameters ✅ ✅ ✅
TestAccept/experimental/aitools/tools/query/scalar ✅ ✅ ✅
TestAccept/experimental/aitools/tools/statement/submit-cancel ✅ ✅ ✅
TestAccept/pipelines/show/failed-statement ✅ ✅ ✅
TestAccept/telemetry/upload-cloud ✅ ✅ ✅
TestAccept/workspace/jobs/tag-limits ✅ ✅ ✅

@eng-dev-ecosystem-bot

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

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 97d721b

Run: 46407524006

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 114 7 2:48
✅​ aws-windows-latest-4core-16gb 114 7 3:49
✅​ azure linux-2core-8gb 114 7 2:27
✅​ azure-windows-latest-4core-16gb 114 7 3:48
✅​ gcp linux-2core-8gb 114 7 2:34
✅​ gcp-windows-latest-4core-16gb 114 7 3:46
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:24 aws-windows-latest-4core-16gb TestAccept
3:22 gcp-windows-latest-4core-16gb TestAccept
3:17 azure-windows-latest-4core-16gb TestAccept

@denik
denik marked this pull request as ready for review November 26, 2026 18:13
@denik
denik requested review from a team as code owners November 26, 2026 18:13
@denik
denik requested review from Sankalp-Mittal, andrewnester and maksim-zuev-db and removed request for maksim-zuev-db November 26, 2026 18:13

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated review at c930429. Each finding was verified against the code.

No blocking issues found. 8 non-blocking comment(s) and 1 question(s) below.

This PR moves the tag-limit, telemetry-endpoint and sqlexec integration tests into acceptance tests with Cloud = true, and deletes testutil.Require/Cloud.Verify. The cloud side mostly matches what the old tests checked. Two things are weaker than before: upload-cloud now fails instead of skipping when the workspace throttles /telemetry-ext, and several local runs only read back their own stubs or injected faults. The rest are smaller departures from .agents/rules/testing.md, which the comments below list.

Questions

  1. The deleted TestSQLExecSubmitAndCancel accepted CANCELED or SUCCEEDED because cancel is best-effort. submit-cancel requires CANCELED through musterr and relies on range(1e11) running long enough. Should the script also accept a statement that finished before the cancel landed, or is the race too unlikely to matter? (non-blocking)

@denik

denik commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

🤖 On the question about submit-cancel: fixed in d623e59. Cancel is best-effort, so the script now runs statement get once, and if it exits 0 (the statement finished before the cancel landed), it prints SKIP_TEST with the final state. Otherwise the golden pins the CANCELED outcome as before, including a nonzero exit. A FAILED or other unexpected state still fails the comparison. Locally the testserver's SQL fake always cancels, so the local run keeps the CANCELED check.

AI agent (opus5.5, isaac_claude)

@denik
denik requested a review from andrewnester November 26, 2026 20:00
denik and others added 4 commits November 30, 2026 10:55
…rop the integration equivalents

Replace integration/libs/tags (6 tests), integration/libs/telemetry (1) and three
of the six integration/libs/sqlexec tests with acceptance tests that run locally
and, for backend facts, on every cloud.

cloud: TestAccept/workspace/jobs/tag-limits TestAccept/telemetry/upload-cloud
cloud: TestAccept/experimental/aitools/tools/query TestAccept/experimental/aitools/tools/statement

Co-authored-by: Isaac <no-reply@databricks.com>
Its only caller was Cloud.Verify, removed with the tags integration tests.

cloud: TestAccept/workspace/jobs/tag-limits TestAccept/telemetry/upload-cloud
cloud: TestAccept/experimental/aitools/tools/query TestAccept/experimental/aitools/tools/statement

Co-authored-by: Isaac <no-reply@databricks.com>
Skip the telemetry test when /telemetry-ext stays throttled, skip
submit-cancel when the statement finished before the cancel, pin the SQL
statement sent by each query test, keep diagnostics in LOG files, report
failed cleanup deletes, and share the warehouse gate of the SQL tests.

cloud: TestAccept/workspace/jobs/tag-limits TestAccept/telemetry/upload-cloud
cloud: TestAccept/experimental/aitools/tools/query TestAccept/experimental/aitools/tools/statement

Co-authored-by: Isaac <no-reply@databricks.com>
errcode was removed on main (#7975); best-effort deletes in cleanup traps
use || true.

cloud: TestAccept/experimental/aitools/tools/query/columns-rows TestAccept/experimental/aitools/tools/query/failed-statement TestAccept/experimental/aitools/tools/query/null-parameter TestAccept/experimental/aitools/tools/query/parameters TestAccept/experimental/aitools/tools/query/scalar TestAccept/experimental/aitools/tools/statement/submit-cancel TestAccept/pipelines/show/failed-statement TestAccept/telemetry/upload-cloud TestAccept/workspace/jobs/tag-limits

Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik removed this pull request from the merge queue due to a manual request Nov 30, 2026
@denik
denik force-pushed the intdep-backend-libs branch from d623e59 to e9b0bd8 Compare November 30, 2026 11:04
@denik
denik enabled auto-merge November 30, 2026 11:06
Its last callers were the integration tests deleted here and in #8074.

cloud: TestAccept/experimental/aitools/tools/query/columns-rows TestAccept/experimental/aitools/tools/query/failed-statement TestAccept/experimental/aitools/tools/query/null-parameter TestAccept/experimental/aitools/tools/query/parameters TestAccept/experimental/aitools/tools/query/scalar TestAccept/experimental/aitools/tools/statement/submit-cancel TestAccept/pipelines/show/failed-statement TestAccept/telemetry/upload-cloud TestAccept/workspace/jobs/tag-limits

Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik added this pull request to the merge queue Nov 30, 2026
Merged via the queue into main with commit a6c8694 Nov 30, 2026
30 checks passed
@denik
denik deleted the intdep-backend-libs branch November 30, 2026 11:47
stevenayers pushed a commit to stevenayers/cli that referenced this pull request Nov 30, 2026
….SQLState (databricks#8113)

## Changes

Removes three parts of `libs/sqlexec` that no production code uses:
- `Client.ExecuteScalar`
- `Result.Scalar`
- the `StatementError.SQLState` field

Tests that only checked them are removed with them:

| test | change |
|---|---|
| `integration/libs/sqlexec` `TestSQLExecScalar` | deleted: apart from
`ExecuteScalar`, it checks that `Execute` returns rows, which
`TestSQLExecColumnsAndRows` also checks |
| `integration/libs/sqlexec` `TestSQLExecNullParameter` | kept, now
calls `Execute` and checks the row: binding an empty `--param x=` as
NULL is behavior `experimental aitools tools query` relies on |
| `integration/libs/sqlexec` `TestSQLExecFailedStatement` | kept,
without the `SQLState` assertion: the typed error's state, code and
message are what the CLI reports |
| `libs/sqlexec` unit tests | `TestResultScalar` deleted;
`TestExecuteScalar` (now `TestExecute`), `TestExecutePollsUntilTerminal`
and `TestHTTPExecutePolls` check `Execute`'s rows instead of
`ExecuteScalar`; one `SQLState` assertion and one `Scalar()` assertion
dropped |

No user-visible change, so no changelog entry.

## Why

Part of moving the deprecated integration tests
([integration/README.md](https://github.com/databricks/cli/blob/main/integration/README.md))
to acceptance tests.
[databricks#8072](databricks#8072) ports the sqlexec
facts that shipped commands rely on to `Cloud = true` acceptance tests
through `experimental aitools tools query` and `statement`: results,
parameters, NULL binding, the FAILED error, submit and cancel. What
those tests can't reach is code that nothing ships, so it goes instead
of being tested. This PR is separate from databricks#8072 so each is easier to
review.

Evidence on main (e5eb6a3) before the change:
- `rg 'ExecuteScalar|\.Scalar\(\)|SQLState'`: outside `_test.go` files
the only hits are the definitions in `libs/sqlexec/sqlexec.go`, plus
`libs/testserver/testsql`. That package has its own `Error.SQLState`,
which fills the fake API response's `sql_state` like the real API does,
so it stays.
- `go tool -modfile=tools/go.mod deadcode ./...` (no `-test`, so only
code reachable from the CLI's `main`):
  ```
  libs/sqlexec/sqlexec.go:193:18: unreachable func: Result.Scalar
  libs/sqlexec/sqlexec.go:320:18: unreachable func: Client.ExecuteScalar
  ```
deadcode doesn't report struct fields. `StatementError.SQLState` is only
written in `newStatementError` and only read by tests.
- After the change `tools/check_deadcode.py` reports no dead code.

## Tests

- `go test ./libs/sqlexec/...`
- AWS runs of the two edited integration tests:
`TestSQLExecNullParameter` and `TestSQLExecFailedStatement` pass.

## Gaps and risks

- If this merges before databricks#8072, NULL binding and the FAILED error are
still checked by the two kept integration tests. Once databricks#8072 merges, its
acceptance tests check them on every cloud, and the two kept tests can
go with the rest of the package.
- databricks#8072 deletes neighboring tests in the same integration file, so
whichever PR merges second may need a trivial rebase.
- deadcode also lists `WithWaitTimeout` and `WithPollInterval` as
unreachable from `main`. Unit tests use them to configure the client, so
they are left out of this PR.
- Risk: low (removes code nothing ships; no behavior change).

This PR was created by the integration-deprecation loop.

🤖 AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

---------

Co-authored-by: Isaac <no-reply@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aitools AI tools (databricks aitools) related changes factory-generated test-only-fix PRs that update failing of flaky tests without changing CLI code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants