From 35d145773074012236557b77be3d078d6efe3b00 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Mon, 19 Oct 2026 13:19:03 +0000 Subject: [PATCH] Allow managed storage roots for DMS acceptance catalogs --- acceptance/bundle/dms/declined-deploy/script | 2 +- acceptance/bundle/dms/failed-recreate/script | 2 +- acceptance/bundle/dms/operation-upload-fails-once/script | 2 +- acceptance/bundle/dms/script.prepare | 9 +++++++++ acceptance/bundle/dms/successful-recreate/script | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/acceptance/bundle/dms/declined-deploy/script b/acceptance/bundle/dms/declined-deploy/script index e0fa60f0763..783f5e91e39 100644 --- a/acceptance/bundle/dms/declined-deploy/script +++ b/acceptance/bundle/dms/declined-deploy/script @@ -13,7 +13,7 @@ title "A destructive change without --auto-approve is declined: this console can # Changing the catalog recreates the schema, which needs approval. # Unity Catalog has no catalog called "other", so make one to move the schema into. other_catalog="dms_other_${UNIQUE_NAME}" -$CLI catalogs create "$other_catalog" &> LOG.catalog +dms_create_catalog "$other_catalog" &> LOG.catalog trap '$CLI catalogs delete "$other_catalog" --force >> LOG.catalog 2>&1; rm -f "$OUT_REQUESTS"' EXIT trace update_file.py databricks.yml "catalog_name: main" "catalog_name: ${other_catalog}" trace musterr $CLI bundle deploy diff --git a/acceptance/bundle/dms/failed-recreate/script b/acceptance/bundle/dms/failed-recreate/script index 60bcc99df10..9735a00e6da 100644 --- a/acceptance/bundle/dms/failed-recreate/script +++ b/acceptance/bundle/dms/failed-recreate/script @@ -19,7 +19,7 @@ title "A recreate deletes and then fails to create. The delete went through, so # Move the schema to a different catalog to force a recreate (catalog_name is immutable), then # fault the schema create so the delete goes through but the create that follows it fails. other_catalog="dms_other_${UNIQUE_NAME}" -$CLI catalogs create "$other_catalog" &> LOG.catalog +dms_create_catalog "$other_catalog" &> LOG.catalog trap '$CLI catalogs delete "$other_catalog" --force >> LOG.catalog 2>&1; rm -f "$OUT_REQUESTS"' EXIT trace update_file.py databricks.yml "catalog_name: main" "catalog_name: ${other_catalog}" trace fault.py "POST /api/2.1/unity-catalog/schemas" 400 0 1 INVALID_PARAMETER_VALUE diff --git a/acceptance/bundle/dms/operation-upload-fails-once/script b/acceptance/bundle/dms/operation-upload-fails-once/script index 2b539134571..30d2987436d 100644 --- a/acceptance/bundle/dms/operation-upload-fails-once/script +++ b/acceptance/bundle/dms/operation-upload-fails-once/script @@ -19,7 +19,7 @@ title "A recreate records twice, and the first one fails: the second must still trace fault.py "PATCH /api/2.0/bundle/*" 500 0 1 # Unity Catalog has no catalog called "other", so make one to move the schema into. other_catalog="dms_other_${UNIQUE_NAME}" -$CLI catalogs create "$other_catalog" &> LOG.catalog +dms_create_catalog "$other_catalog" &> LOG.catalog trap '$CLI catalogs delete "$other_catalog" --force >> LOG.catalog 2>&1' EXIT trace update_file.py databricks.yml "catalog_name: main" "catalog_name: ${other_catalog}" trace musterr $CLI bundle deploy --auto-approve diff --git a/acceptance/bundle/dms/script.prepare b/acceptance/bundle/dms/script.prepare index c67f63ef8e0..acbf6af88f5 100644 --- a/acceptance/bundle/dms/script.prepare +++ b/acceptance/bundle/dms/script.prepare @@ -11,3 +11,12 @@ dms_plan() { deployment_history_telemetry() { jq -r 'select(.path? == "/telemetry-ext") | .body.protoLogs[] | fromjson | .entry.databricks_cli_log.bundle_deploy_event.experimental.bool_values[] | select(.key == "deployment_history_enabled") | "\(.key) \(.value)"' "$OUT_REQUESTS" } + +# Metastores without a storage root need an explicit managed location for each catalog. +dms_create_catalog() { + local storage_args=() + if [[ -n ${TEST_UC_MANAGED_STORAGE_ROOT:-} ]]; then + storage_args=(--storage-root "${TEST_UC_MANAGED_STORAGE_ROOT%/}/$1") + fi + $CLI catalogs create "$1" "${storage_args[@]}" +} diff --git a/acceptance/bundle/dms/successful-recreate/script b/acceptance/bundle/dms/successful-recreate/script index 87bdc98bc34..6ca3764d383 100644 --- a/acceptance/bundle/dms/successful-recreate/script +++ b/acceptance/bundle/dms/successful-recreate/script @@ -20,7 +20,7 @@ title "Recreate writes state twice - the entry is dropped, then the new resource # The drop opens it IN_PROGRESS, the save patches it to SUCCEEDED. # Unity Catalog has no catalog called "other", so make one to move the schema into. other_catalog="dms_other_${UNIQUE_NAME}" -$CLI catalogs create "$other_catalog" &> LOG.catalog +dms_create_catalog "$other_catalog" &> LOG.catalog trap '$CLI catalogs delete "$other_catalog" --force >> LOG.catalog 2>&1' EXIT trace update_file.py databricks.yml "catalog_name: main" "catalog_name: ${other_catalog}" trace $CLI bundle deploy --auto-approve