Repository navigation
acc: cover tag limits, SQL execution and telemetry upload on cloud, drop the integration equivalents - #8072
Conversation
Regression test report ✅Commit: Selected 9 changed tests (limit=20, 0 not selected) 9 tests: regression=0 unreleased=0 coverage=9 failing=0
|
✅ Integration test reportCommit: 97d721b
Top 3 slowest tests (at least 2 minutes):
|
There was a problem hiding this comment.
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
- The deleted
TestSQLExecSubmitAndCancelaccepted CANCELED or SUCCEEDED because cancel is best-effort.submit-cancelrequires CANCELED throughmusterrand relies onrange(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)
|
🤖 On the question about AI agent (opus5.5, isaac_claude) |
…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>
d623e59 to
e9b0bd8
Compare
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>
….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>
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):TestTagKeyAWS,TestTagValueAWSworkspace/jobs/tag-limits(aws table)TestTagKeyAzure,TestTagValueAzureworkspace/jobs/tag-limits(azure table)TestTagKeyGCP,TestTagValueGCPworkspace/jobs/tag-limits(gcp table)TestTelemetryEndpointtelemetry/upload-cloudTestSQLExecColumnsAndRowsexperimental/aitools/tools/query/columns-rowsTestSQLExecParametersexperimental/aitools/tools/query/parametersTestSQLExecSubmitAndCancelexperimental/aitools/tools/statement/submit-cancelNew acceptance tests:
workspace/jobs/tag-limits:jobs createwith 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 withjobs get. The testserver does not validate tags, so the local run injects the rejections withfault.py --body-contains. Every created job is deleted on exit.telemetry/upload-cloud: the raw/telemetry-extresponse to two test events (api post;errors: [],numProtoSuccess: 2), thenselftest send-telemetrythrough 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}andstatement/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 ofsqlexec.Execute, whose only caller ispipelines show.Also removes
testutil.RequireandCloud.Verify: the tags tests were their only callers.Not in this PR:
TestSQLExecScalar,TestSQLExecNullParameterandTestSQLExecFailedStatementstay in place. Their facts are ported above, but each has something no command reaches:ExecuteScalar/Result.Scalarhave no production caller, and no command readsStatementError.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 oftag-limitson this PR's cloud run."Harness" blocks are
integration/internal/accandinternal/testutil: the integration tests' own setup. No real-gap blocks remain for the deleted tests.Assertion map
numProtoSuccess2,errorsempty"errors": [],"numProtoSuccess": 2; CLI upload: "All 2 logs uploaded successfully"SKIP_TESTwhen the failed upload shows a 429, in both stepsid, doubledin order; rows 0,0 / 1,2 / 2,4get-> CANCELED with error, exit 1; SUCCEEDED (cancel too late) skipsRuntime
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
[[Server]]stubs because acceptance tests can't register statements in the testserver's SQL engine. The cloud run pins the real responses.fault.pyfor the local rejections, and the query tests keep[[Server]]stubs: validating tags in the testserver's jobs handler, and registering SQL matchers fromtest.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
cloud:line (see the Integration test report).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.