Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions acceptance/bundle/invariant/auto-migrate/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions acceptance/bundle/invariant/auto-migrate/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
INPUT_CONFIG_OK
17 changes: 17 additions & 0 deletions acceptance/bundle/invariant/auto-migrate/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Invariant to test: auto-migration on deploy is successful, no drift after deploy
# Additional checks: no internal errors / panics in any commands

unset DATABRICKS_BUNDLE_ENGINE

invariant_setup

invariant_deploy LOG.deploy DATABRICKS_BUNDLE_ENGINE=terraform $CLI bundle deploy

# Deploy on the direct default (engine unset): this migrates the terraform state to the
# direct engine before deploying, exercising the auto path. Not invariant_deploy -- the
# config was already validated by the terraform deploy above, so a failure here is a bug,
# not an invalid config (and it must not re-emit the INPUT_CONFIG_OK marker).
trace $CLI bundle deploy &> LOG.migrate
cat LOG.migrate | contains.py '!panic:' '!internal error' > /dev/null

invariant_verify_no_drift
64 changes: 64 additions & 0 deletions acceptance/bundle/invariant/auto-migrate/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Recording needs a bundle it has seen from the start. This test seeds a state file,
# so recording refuses it. TODO(DMS): drop this once existing state can be
# handed over to the service (see the TODO in dstate.Open).
EnvMatrix.DMS = [""]

# schema.yml sets custom_max_retention_hours, which the terraform databricks_schema resource cannot
# set (only direct does), so a terraform-first migrate would drift. schema_tf_compat.yml keeps migrate
# coverage for schemas.
EnvMatrixExclude.no_schema_custom_retention = ["INPUT_CONFIG=schema.yml.tmpl"]

# vector_search_endpoints and vector_search_indexes have no terraform converter
EnvMatrixExclude.no_vector_search_endpoint = ["INPUT_CONFIG=vector_search_endpoint.yml.tmpl"]
EnvMatrixExclude.no_vector_search_index = ["INPUT_CONFIG=vector_search_index.yml.tmpl"]

# job_runs is a direct-only resource with no terraform converter, so the
# terraform deploy that seeds the migration fails for it.
EnvMatrixExclude.no_job_run = ["INPUT_CONFIG=job_run.yml.tmpl"]

# Error: Catalog resources are only supported with direct deployment mode
EnvMatrixExclude.no_catalog = ["INPUT_CONFIG=catalog.yml.tmpl"]
EnvMatrixExclude.no_catalog_optional_fields = ["INPUT_CONFIG=catalog_optional_fields.yml.tmpl"]
EnvMatrixExclude.no_external_location = ["INPUT_CONFIG=external_location.yml.tmpl"]
# uc_trailing_slash includes a catalog, which is direct-only (see above).
EnvMatrixExclude.no_uc_trailing_slash = ["INPUT_CONFIG=uc_trailing_slash.yml.tmpl"]
# Genie spaces are direct-only too; the terraform deploy that seeds the migration fails for them.
EnvMatrixExclude.no_genie_space = ["INPUT_CONFIG=genie_space.yml.tmpl"]
# Instance pools are direct-only; the terraform deploy that seeds the migration fails for them.
EnvMatrixExclude.no_instance_pool = ["INPUT_CONFIG=instance_pool.yml.tmpl"]
# Cluster policies are direct-only; the terraform deploy that seeds the migration fails for them.
EnvMatrixExclude.no_cluster_policy = ["INPUT_CONFIG=cluster_policy.yml.tmpl"]
# Cluster libraries are direct-only; the terraform deploy that seeds the migration fails for them.
EnvMatrixExclude.no_cluster_libraries = ["INPUT_CONFIG=cluster_libraries.yml.tmpl"]
# AI Gateway securables are direct-only; the terraform deploy that seeds the migration fails for them.
EnvMatrixExclude.no_model_service = ["INPUT_CONFIG=model_service.yml.tmpl"]

# Cross-resource permission references (e.g. ${resources.jobs.job_b.permissions[0].level})
# don't work in terraform mode: the terraform interpolator converts the path to
# ${databricks_job.job_b.permissions[0].level}, but Terraform's databricks_job resource
# does not expose permissions as output attributes (permissions are a separate
# databricks_permissions resource in terraform), so the literal unresolved string
# ends up as the permission level value.
EnvMatrixExclude.no_permission_ref = ["INPUT_CONFIG=job_permission_ref.yml.tmpl"]
EnvMatrixExclude.no_cross_resource_ref = ["INPUT_CONFIG=job_cross_resource_ref.yml.tmpl"]

# Grant cross-references require the EmbeddedSlice pattern not present in terraform mode.
EnvMatrixExclude.no_grant_ref = ["INPUT_CONFIG=schema_grant_ref.yml.tmpl"]

# SQL warehouses currently failing with migration with permanent drift. TODO: fix this.
EnvMatrixExclude.no_sql_warehouse = ["INPUT_CONFIG=sql_warehouse.yml.tmpl"]

# The 1000-task scale case is covered by no_drift. Running it here adds ~1.5 min
# per variant (deploy + migrate + plan at 1000 tasks) without incremental coverage.
EnvMatrixExclude.no_pydabs_1000_tasks = ["INPUT_CONFIG=job_pydabs_1000_tasks.yml.tmpl"]

# migrate deploys via Terraform first, and the TF provider rejects an uppercase
# volume schema_name ("inconsistent final plan"). Covered by no_drift on direct.
EnvMatrixExclude.no_volume_uppercase = ["INPUT_CONFIG=volume_uppercase_name.yml.tmpl"]

# UC secrets are direct-only (no terraform converter), so the terraform deploy that seeds
# the migration fails for them.
EnvMatrixExclude.no_secret = ["INPUT_CONFIG=secret.yml.tmpl"]

# Terraform types sampling_fraction as an integer and truncates 0.5; covered by no_drift.
EnvMatrixExclude.no_model_serving_endpoint_telemetry = ["INPUT_CONFIG=model_serving_endpoint_telemetry.yml.tmpl"]
11 changes: 7 additions & 4 deletions acceptance/selftest/selection/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Selected 2 changed tests (limit=50, 0 not selected)
=== Touching an invariant config runs every invariant test, for that config only

>>> selection M:acceptance/bundle/invariant/configs/job.yml.tmpl
Selected 5 changed tests (limit=50, 0 not selected)
Selected 6 changed tests (limit=50, 0 not selected)
5 ^bundle$/^invariant$/^auto-migrate$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=job\.yml\.tmpl$
5 ^bundle$/^invariant$/^continue_293$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=job\.yml\.tmpl$
5 ^bundle$/^invariant$/^delete_idempotent$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=job\.yml\.tmpl$
5 ^bundle$/^invariant$/^destroy_idempotent$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=job\.yml\.tmpl$
Expand All @@ -39,13 +40,15 @@ Selected 5 changed tests (limit=50, 0 not selected)
=== Adding one invariant config and touching another: only the new variant is new

>>> selection A:acceptance/bundle/invariant/configs/pipeline.yml.tmpl M:acceptance/bundle/invariant/configs/job.yml.tmpl
Selected 10 changed tests (limit=50, 0 not selected)
Selected 12 changed tests (limit=50, 0 not selected)
10 ^bundle$/^invariant$/^auto-migrate$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=pipeline\.yml\.tmpl$
10 ^bundle$/^invariant$/^continue_293$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=pipeline\.yml\.tmpl$
10 ^bundle$/^invariant$/^delete_idempotent$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=pipeline\.yml\.tmpl$
10 ^bundle$/^invariant$/^destroy_idempotent$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=pipeline\.yml\.tmpl$
10 ^bundle$/^invariant$/^migrate$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=pipeline\.yml\.tmpl$
10 ^bundle$/^invariant$/^no_drift$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=pipeline\.yml\.tmpl$
10 ^bundle$/^invariant$/^no_drift$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=true$/^INPUT_CONFIG=pipeline\.yml\.tmpl$
5 ^bundle$/^invariant$/^auto-migrate$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=job\.yml\.tmpl$
5 ^bundle$/^invariant$/^continue_293$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=job\.yml\.tmpl$
5 ^bundle$/^invariant$/^delete_idempotent$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=job\.yml\.tmpl$
5 ^bundle$/^invariant$/^destroy_idempotent$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=job\.yml\.tmpl$
Expand All @@ -71,7 +74,7 @@ Selected 1 changed tests (limit=50, 0 not selected)
=== The limit keeps the highest scoring tests

>>> selection -limit 3 A:acceptance/selftest/basic/script M:acceptance/selftest/diff/script M:acceptance/bundle/invariant/configs/job.yml.tmpl
Selected 3 changed tests (limit=3, 4 not selected)
Selected 3 changed tests (limit=3, 5 not selected)
10 ^selftest$/^basic$
5 ^bundle$/^invariant$/^auto-migrate$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=job\.yml\.tmpl$
5 ^bundle$/^invariant$/^continue_293$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=job\.yml\.tmpl$
5 ^bundle$/^invariant$/^delete_idempotent$/^DATABRICKS_BUNDLE_ENGINE=direct$/^DMS=$/^INPUT_CONFIG=job\.yml\.tmpl$
Loading