Skip to content

[Internal] Increase tests coverage for manual resources#5776

Open
tanmay-db wants to merge 4 commits into
mainfrom
unified-host-resource-acc-coverage
Open

[Internal] Increase tests coverage for manual resources#5776
tanmay-db wants to merge 4 commits into
mainfrom
unified-host-resource-acc-coverage

Conversation

@tanmay-db

@tanmay-db tanmay-db commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

WIP

Changes

  • Adding integration tests for manually maintained resources

Tests

  • Added tests pass
    NO_CHANGELOG=true

PR #5759 switched the SDKv2 "raw HTTP" resources to inject the
X-Databricks-Workspace-Id routing header per-callsite. This adds apply-based
acceptance tests that exercise that path end-to-end via a
provider_config { workspace_id } block (create + read round-trip), verifying
each resource lands in the right workspace through the SDK workspace client.

Coverage added (TestMwsAccUnifiedHost* = account provider on the unified host;
*_WorkspaceLevel = normal workspace provider, added only where no real apply
test existed before):

  token, dbfs_file, cluster, instance_pool, sql_query, sql_visualization,
  sql_table, table (legacy), provider (sharing), instance_profile (AWS-gated),
  permission_assignment

The existing *_provider_config_test.go tests are PlanOnly and never hit the API,
so they do not cover this. Resources intentionally not covered (with rationale in
the file header): sql_dashboard/sql_widget (legacy create disabled server-side),
mount + variants (already covered, no SDK GET), sql_permissions (needs table-ACL
cluster), obo_token (cross-level admin SP setup), sql_global_config (shared
singleton needing the cross-test lock).

Test-only change; no production code touched. The two workspace-level tests were
verified green against a live AWS workspace; the unified-host variants run in the
integration-test workflow where UNIFIED_HOST is provisioned.
@tanmay-db tanmay-db requested review from a team as code owners June 2, 2026 11:36
@tanmay-db tanmay-db requested review from hectorcast-db and removed request for a team and hectorcast-db June 2, 2026 11:36
@tanmay-db tanmay-db temporarily deployed to test-trigger-is June 2, 2026 11:36 — with GitHub Actions Inactive
@tanmay-db tanmay-db temporarily deployed to test-trigger-is June 2, 2026 11:37 — with GitHub Actions Inactive
Adds a normal-workspace-provider apply test (*_WorkspaceLevel) alongside the
existing unified-host test for every resource in the suite, so each resource is
exercised both ways: account provider on the unified host (routing header) and a
plain workspace-level provider on a normal host. Both reuse the same helper, so
the only difference is the provider factory + env.

New workspace-level tests: token, cluster, instance_profile, sql_query,
sql_visualization, sql_table, provider (sharing). (dbfs_file, instance_pool and
table already had one.)

databricks_permission_assignment stays unified-only: it assigns an account-level
principal, which a workspace-level provider cannot create in a self-contained test.
@tanmay-db tanmay-db temporarily deployed to test-trigger-is June 2, 2026 11:40 — with GitHub Actions Inactive
@tanmay-db tanmay-db temporarily deployed to test-trigger-is June 2, 2026 11:40 — with GitHub Actions Inactive
Three tests added on this branch failed the integration runs:

- databricks_table (TestUcAccTable_WorkspaceLevel + TestMwsAccUnifiedHostCreateTable):
  the column block omitted the required type_json field, so CreateTable failed with
  "Missing required field: column_0.type_json". Add type_json, matching the working
  config in catalog/grant_test.go.

- databricks_permission_assignment (TestMwsAccUnifiedHostCreatePermissionAssignment):
  the databricks_service_principal dependency is a dual account/workspace resource,
  which must declare `api` on a unified host (common/unified_provider.go). Plan failed
  with "please set api to account or workspace". Set api = "account".

- databricks_instance_profile (TestAccInstanceProfile_WorkspaceLevel): the test used
  TEST_EC2_INSTANCE_PROFILE, a real profile already attached to the workspace, so
  create failed with "already been added to WorkerEnvId". Register a unique throwaway
  ARN with skip_validation = true instead: self-contained, no shared-fixture conflict
  with the parallel TestAccInstanceProfileIntegrationSuite, and it also un-skips the
  account-level variant (no TEST_EC2_INSTANCE_PROFILE dependency).

Verified locally: InstanceProfile passes against a live AWS workspace; the table
type_json error no longer occurs (apply proceeds past table validation).

Co-authored-by: Isaac
@tanmay-db tanmay-db temporarily deployed to test-trigger-is June 2, 2026 13:08 — with GitHub Actions Inactive
@tanmay-db tanmay-db temporarily deployed to test-trigger-is June 2, 2026 13:08 — with GitHub Actions Inactive
TestMwsAccUnifiedHostCreatePermissionAssignment failed on gcp-acct-prod-is with
"Permission assignment APIs are not available for this workspace."
databricks_permission_assignment requires the target workspace to be enabled for
identity federation (i.e. assigned a Unity Catalog metastore); the GCP plain-account
test workspace is not federated. The AWS/Azure account workspaces and all UC-account
workspaces are, so the test keeps running there.

Skip only on GCP + plain ACCOUNT env, leaving coverage intact everywhere else.

Co-authored-by: Isaac
@tanmay-db tanmay-db temporarily deployed to test-trigger-is June 3, 2026 09:48 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

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

Trigger:
go/deco-tests-run/terraform

Inputs:

  • PR number: 5776
  • Commit SHA: 02e2aa43a8a7128de1da3a02d898f16e5ba40cf2

Checks will be approved automatically on success.

@tanmay-db tanmay-db temporarily deployed to test-trigger-is June 3, 2026 09:49 — with GitHub Actions Inactive
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