Skip to content

[Internal] Use TEST_ENVIRONMENT_TYPE for integration test environment detection#1553

Draft
tanmay-db wants to merge 1 commit intomainfrom
upd-test-infra
Draft

[Internal] Use TEST_ENVIRONMENT_TYPE for integration test environment detection#1553
tanmay-db wants to merge 1 commit intomainfrom
upd-test-infra

Conversation

@tanmay-db
Copy link
Copy Markdown
Contributor

@tanmay-db tanmay-db commented Mar 17, 2026

Summary

Centralizes integration test environment detection by replacing scattered ad-hoc checks with a single TEST_ENVIRONMENT_TYPE environment variable and a shared
skipIfNotEnvironmentType() helper.

Why

Today, each test prelude (workspaceTest, ucwsTest, accountTest, ucacctTest) uses its own combination of environment variable checks
(DATABRICKS_ACCOUNT_ID, TEST_METASTORE_ID) and runtime host-type inspection (cfg.HostType()) to decide whether to skip. This is fragile — different preludes
use different heuristics, making it easy for tests to run in the wrong environment or to silently pass when they should be skipped.

A single TEST_ENVIRONMENT_TYPE variable (ACCOUNT, WORKSPACE, UC_ACCOUNT, UC_WORKSPACE) set by the CI environment makes the contract explicit and
consistent across all test levels.

What changed

Interface changes

None.

Behavioral changes

None — this is a pure refactor of internal test infrastructure. Tests that previously skipped via ad-hoc checks now skip via TEST_ENVIRONMENT_TYPE. If the
variable is unset, tests skip with a clear message.

Internal changes

  • Added skipIfNotEnvironmentType(t, expectedType) helper in internal/init_test.go
  • workspaceTest: replaced DATABRICKS_ACCOUNT_ID presence check with skipIfNotEnvironmentType(t, "WORKSPACE")
  • ucwsTest: replaced DATABRICKS_ACCOUNT_ID + TEST_METASTORE_ID checks with skipIfNotEnvironmentType(t, "UC_WORKSPACE")
  • accountTest: replaced post-resolve cfg.HostType() check with skipIfNotEnvironmentType(t, "ACCOUNT") before config resolution
  • ucacctTest: replaced post-resolve cfg.HostType() check with skipIfNotEnvironmentType(t, "UC_ACCOUNT") before config resolution

How is this tested?

Mirrors the same change already validated in the Terraform provider (databricks/terraform-provider-databricks#5476). Integration tests will be validated in CI with
TEST_ENVIRONMENT_TYPE set.

NO_CHANGELOG=true

@tanmay-db tanmay-db temporarily deployed to test-trigger-is March 17, 2026 13:23 — with GitHub Actions Inactive
@github-actions
Copy link
Copy Markdown

Please ensure that the NEXT_CHANGELOG.md file is updated with any relevant changes.
If this is not necessary for your PR, please include the following in your PR description:
NO_CHANGELOG=true
and rerun the job.

@tanmay-db tanmay-db temporarily deployed to test-trigger-is March 17, 2026 13:24 — with GitHub Actions Inactive
@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-go

Inputs:

  • PR number: 1553
  • Commit SHA: 45c99c50d57beaa6e9b9d222631b365107c7047e

Checks will be approved automatically on success.

@tanmay-db tanmay-db changed the title [Internal] [Internal] Use TEST_ENVIRONMENT_TYPE for integration test environment detection Mar 17, 2026
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