Skip to content

Use TEST_ENVIRONMENT_TYPE for integration test filtering and deprecate is_account_client docstrings#1317

Merged
hectorcast-db merged 1 commit intomainfrom
hectorcast-db/stack/use-test-environment-type-in-integration-tests
Mar 11, 2026
Merged

Use TEST_ENVIRONMENT_TYPE for integration test filtering and deprecate is_account_client docstrings#1317
hectorcast-db merged 1 commit intomainfrom
hectorcast-db/stack/use-test-environment-type-in-integration-tests

Conversation

@hectorcast-db
Copy link
Copy Markdown
Contributor

@hectorcast-db hectorcast-db commented Mar 10, 2026

🥞 Stacked PR

Use this link to review incremental changes.


Summary

Replace is_account_client heuristics and DATABRICKS_ACCOUNT_ID presence checks in integration test fixtures with explicit TEST_ENVIRONMENT_TYPE-based filtering. Also deprecate is_account_client in docstrings across Config and ApiClient.

Why

Integration test fixtures in tests/integration/conftest.py used two different heuristics to decide whether a test should run:

  1. account_client.config.is_account_client — inspects the host URL to infer whether the SDK is talking to an account-level API. This is unreliable now that unified hosts can serve both account and workspace APIs, and the property already raises ValueError when experimental_is_unified_host is set.
  2. "DATABRICKS_ACCOUNT_ID" in os.environ — a proxy check used to skip workspace fixtures on account environments. This is fragile and doesn't express intent clearly.

The test orchestrator now sets TEST_ENVIRONMENT_TYPE explicitly to one of ACCOUNT, UC_ACCOUNT, WORKSPACE, or UC_WORKSPACE. Using this value directly makes fixture skip-guards authoritative and easy to reason about.

What changed

Interface changes

None. No public SDK API changes.

Behavioral changes

None for SDK users. Integration test fixture skip conditions are now driven by TEST_ENVIRONMENT_TYPE instead of is_account_client and DATABRICKS_ACCOUNT_ID.

Internal changes

  • tests/integration/conftest.py: All four client fixtures (a, ucacct, w, ucws) now check TEST_ENVIRONMENT_TYPE against an explicit allowlist instead of using is_account_client or DATABRICKS_ACCOUNT_ID.
  • databricks/sdk/config.py: Updated is_account_client docstring to note deprecation — clients can now support both workspace and account APIs from a single host.
  • databricks/sdk/core.py: Added matching deprecation note to ApiClient.is_account_client.

How is this tested?

The changed code is test infrastructure itself. Correctness will be validated when integration tests run against environments that set TEST_ENVIRONMENT_TYPE.

NO_CHANGELOG=true

Copy link
Copy Markdown
Contributor

@tejaskochar-db tejaskochar-db left a comment

Choose a reason for hiding this comment

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

lgtm mod comment

@hectorcast-db hectorcast-db force-pushed the hectorcast-db/stack/use-test-environment-type-in-integration-tests branch from 1ecc86d to 5508849 Compare March 11, 2026 09:42
@hectorcast-db hectorcast-db enabled auto-merge March 11, 2026 09:43
@hectorcast-db hectorcast-db force-pushed the hectorcast-db/stack/use-test-environment-type-in-integration-tests branch from 5508849 to 0eff155 Compare March 11, 2026 09:44
@github-actions
Copy link
Copy Markdown

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-py

Inputs:

  • PR number: 1317
  • Commit SHA: 0eff155d0ca7fc796d878cf9ee332dac5149be6a

Checks will be approved automatically on success.

@hectorcast-db hectorcast-db added this pull request to the merge queue Mar 11, 2026
Merged via the queue into main with commit f120ec7 Mar 11, 2026
17 checks passed
@hectorcast-db hectorcast-db deleted the hectorcast-db/stack/use-test-environment-type-in-integration-tests branch March 11, 2026 12:01
github-merge-queue bot pushed a commit to databricks/databricks-sdk-go that referenced this pull request Mar 18, 2026
## 🥞 Stacked PR
Use this
[link](https://github.com/databricks/databricks-sdk-go/pull/1545/files)
to review incremental changes.
-
[**stack/port/test-environment-type**](#1545)
[[Files
changed](https://github.com/databricks/databricks-sdk-go/pull/1545/files)]
-
[stack/port/host-metadata-integration-test](#1546)
[[Files
changed](https://github.com/databricks/databricks-sdk-go/pull/1546/files/c5bb35f157c24cbeb92396330626119a72cb2de7..996e3f148d614483fbd3302e8c5a75fbf2c32afc)]
-
[stack/port/remove-unified-flag](#1547)
[[Files
changed](https://github.com/databricks/databricks-sdk-go/pull/1547/files/996e3f148d614483fbd3302e8c5a75fbf2c32afc..5bfb6b121ee68f765a5ed4cb194f58372c9d7bf5)]
-
[stack/port/gcp-sa-from-metadata](#1548)
[[Files
changed](https://github.com/databricks/databricks-sdk-go/pull/1548/files/5bfb6b121ee68f765a5ed4cb194f58372c9d7bf5..6bfe5a46df8e98136ae1fa675158f5babc50ede4)]

---------
## Summary
- Port of Python SDK PR
databricks/databricks-sdk-py#1317
- Add `TEST_ENVIRONMENT_TYPE` environment variable support for
integration test filtering
- Supported values: `WORKSPACE`, `UC_WORKSPACE`, `ACCOUNT`, `UC_ACCOUNT`
- Falls back to existing `DATABRICKS_ACCOUNT_ID`-based logic when not
set

## Test plan
- Integration test preludes updated; backward compatible with existing
CI

NO_CHANGELOG=true

This pull request was AI-assisted by Isaac.
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.

2 participants