Conversation
… hack - ResourceFixture: add Host field for explicit host control in tests - Mock-based tests: explicitly set Host = "https://accounts.cloud.databricks.com" alongside AccountID (no implicit defaults) - MockAccountsApply: set accounts host URL in config - Fixture-based tests: add api = "account" to HCL/State for account-level routing - Convert TestStorageCredentialImportAccountLevel from fixtures to mocks - Remove empty Fixtures from data_current_config account tests (use mock path) Tests still use SDK HostType() in production code — this PR only decouples the test infrastructure so it no longer depends on isTesting + AccountID. Co-authored-by: Isaac
7aad84d to
e7d7787
Compare
MockAccountsApply now inherits the outer DatabricksClient Host from the mock AccountClient's own Config. Exporter account tests no longer call Config.WithTesting(), so account-level routing must come from an explicit Host URL on the mock client rather than the SDK's isTesting back-door.
…c tests Follow-up to decoupling MockAccountsApply from hardcoded accounts Host: these callbacks previously relied on the SDK's isTesting shortcut for account routing. Each now populates ma.AccountClient.Config with an explicit Host so HostType() resolves via URL-prefix matching.
…aform() - Add HostTypeForTerraform() method on *DatabricksClient that uses only Experimental_IsUnifiedHost and URL prefix matching (no resolvedHostType or isTesting dependency) - Replace all 12 call sites of SDK's deprecated HostType() across 7 files - Update exporter test helpers to use HostTypeForTerraform() - Update TestResourceGroupCreate_ApiFieldNotSet_FallsBackToHostInference expectations to reflect URL-based host inference Co-authored-by: Isaac
Verifies the production path: when a user configures host = "https://accounts.cloud.databricks.com" without setting api = "account", HostTypeForTerraform() detects the accounts URL prefix and IsAccountLevel() returns true. Co-authored-by: Isaac
Co-authored-by: Isaac
e7d7787 to
727db40
Compare
…ricks into stack/hosttype-replace
Contributor
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
slimbnsalah
pushed a commit
to slimbnsalah/terraform-provider-databricks
that referenced
this pull request
Apr 21, 2026
## Changes Decouples provider tests from the Databricks Go SDK's `Config.HostType()` back-door, where `isTesting && AccountID != ""` causes `HostType()` to return `AccountHost` regardless of the configured `Host`. Tests previously relied on this shortcut by setting only `AccountID` and leaving `Host` empty. This PR makes every account-level test declare its Host explicitly, so the SDK can eventually drop the `isTesting` special-case without provider-test fallout. 1. **`qa/testing.go`** — `ResourceFixture` gains a `Host` field that threads into `config.Config.Host`. `MockAccountsApply` now reads `Host` from the mock account client's own config (`ma.AccountClient.Config.Host`) instead of hardcoding `https://accounts.cloud.databricks.com` — the test now owns the value. 2. **`exporter/importables_test.go`** — `importContextForAccountTestWithClient` no longer calls `client.Config.WithTesting()`. Exporter account tests no longer ride the SDK's `isTesting` shortcut. 3. **~20 `ResourceFixture` tests** (`catalog/`, `mws/`, `scim/`, `apps/`, `finops/`, `permissions/`, `tokens/`) — set `Host` explicitly where needed, or add `api = "account"` to HCL so the resource's own routing logic runs. Dead `Fixtures: []qa.HTTPFixture{}` entries removed from tests that made no HTTP calls. 4. **`exporter/impl_{billing,serverless,uc}_test.go`** — 29 callbacks now call `setupAwsAccountConfig(ma)` (or `setupAzureAccountConfig(ma)` for Azure-specific tests) at the top, matching the existing convention in `impl_mws_test.go` / `impl_oauth_test.go`. Replaces partial `Config = &config.Config{AccountID: ...}` inline blocks that silently relied on `WithTesting()` to fill in the Host. ### Storage credential conversion `TestStorageCredentialImportAccountLevel` converted from `HTTPFixture` to `MockAccountClientFunc` since the test exercises mock-client paths. ## Tests - `make fmt` ✅ - `make lint` ✅ - `make test` — 3084 tests pass, 0 failures - Tested by removing the isTesting check: databricks#5593 NO_CHANGELOG=true
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Validating #5592 by removing isTesting check
NO_CHANGELOG=true