diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 392d431a81..a41efc4fa0 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -30,6 +30,7 @@ import ( "github.com/databricks/cli/internal/testutil" "github.com/databricks/cli/libs/auth" "github.com/databricks/cli/libs/testdiff" + "github.com/databricks/cli/libs/testserver" "github.com/databricks/cli/libs/utils" "github.com/stretchr/testify/require" ) @@ -152,6 +153,7 @@ func TestInprocessMode(t *testing.T) { func setReplsForTestEnvVars(t *testing.T, repls *testdiff.ReplacementsContext) { envVars := []string{ "TEST_DEFAULT_WAREHOUSE_ID", + "TEST_DEFAULT_CLUSTER_ID", "TEST_INSTANCE_POOL_ID", } for _, envVar := range envVars { @@ -244,7 +246,10 @@ func testAccept(t *testing.T, inprocessMode bool, singleTest string) int { if cloudEnv == "" { internal.StartDefaultServer(t, LogRequests) if os.Getenv("TEST_DEFAULT_WAREHOUSE_ID") == "" { - t.Setenv("TEST_DEFAULT_WAREHOUSE_ID", "8ec9edc1-db0c-40df-af8d-7580020fe61e") + t.Setenv("TEST_DEFAULT_WAREHOUSE_ID", testserver.TestDefaultWarehouseId) + } + if os.Getenv("TEST_DEFAULT_CLUSTER_ID") == "" { + t.Setenv("TEST_DEFAULT_CLUSTER_ID", testserver.TestDefaultClusterId) } } diff --git a/acceptance/bundle/deployment/bind/cluster/output.txt b/acceptance/bundle/deployment/bind/cluster/output.txt index aeb195f0f1..9c194337e7 100644 --- a/acceptance/bundle/deployment/bind/cluster/output.txt +++ b/acceptance/bundle/deployment/bind/cluster/output.txt @@ -1,12 +1,12 @@ ->>> [CLI] clusters get [CLUSTER-ID] +>>> [CLI] clusters get [TEST_DEFAULT_CLUSTER_ID] { "cluster_name": "DEFAULT Test Cluster" } ->>> [CLI] bundle deployment bind cluster1 [CLUSTER-ID] --auto-approve +>>> [CLI] bundle deployment bind cluster1 [TEST_DEFAULT_CLUSTER_ID] --auto-approve Updating deployment state... -Successfully bound cluster with an id '[CLUSTER-ID]' +Successfully bound cluster with an id '[TEST_DEFAULT_CLUSTER_ID]' Run 'bundle deploy' to deploy changes to your workspace >>> [CLI] bundle deployment unbind cluster1 diff --git a/acceptance/bundle/deployment/bind/cluster/test.toml b/acceptance/bundle/deployment/bind/cluster/test.toml index 17358b5e7f..bebdb0bbcd 100644 --- a/acceptance/bundle/deployment/bind/cluster/test.toml +++ b/acceptance/bundle/deployment/bind/cluster/test.toml @@ -1,19 +1,3 @@ Local = true Cloud = true RequiresCluster = true - -Ignore = [ - "databricks.yml", -] - -[[Repls]] -Old = "[0-9]{4}-[0-9]{6}-[0-9a-z]{8}" -New = "[CLUSTER-ID]" - -[[Server]] -Pattern = "GET /api/2.1/clusters/get" -Response.Body = ''' -{ - "cluster_name": "DEFAULT Test Cluster" -} -''' diff --git a/acceptance/bundle/deployment/bind/dashboard/output.txt b/acceptance/bundle/deployment/bind/dashboard/output.txt index 3926b8f1f9..5d3f23d4a7 100644 --- a/acceptance/bundle/deployment/bind/dashboard/output.txt +++ b/acceptance/bundle/deployment/bind/dashboard/output.txt @@ -12,15 +12,15 @@ Deployment complete! >>> [CLI] lakeview get [DASHBOARD_ID] { - "display_name": "test dashboard [UUID]", + "display_name": "test dashboard [UNIQUE_NAME]", "lifecycle_state": "ACTIVE", - "path": "/Users/[USERNAME]/test dashboard [UUID].lvdash.json", "parent_path": "/Users/[USERNAME]", + "path": "/Users/[USERNAME]/test dashboard [UNIQUE_NAME].lvdash.json", "serialized_dashboard": { "pages": [ { - "name": "02724bf2", "displayName": "Page One", + "name": "02724bf2", "pageType": "PAGE_TYPE_CANVAS" } ] @@ -38,15 +38,15 @@ Destroy complete! >>> [CLI] lakeview get [DASHBOARD_ID] { - "display_name": "test dashboard [UUID]", + "display_name": "test dashboard [UNIQUE_NAME]", "lifecycle_state": "ACTIVE", - "path": "/Users/[USERNAME]/test dashboard [UUID].lvdash.json", "parent_path": "/Users/[USERNAME]", + "path": "/Users/[USERNAME]/test dashboard [UNIQUE_NAME].lvdash.json", "serialized_dashboard": { "pages": [ { - "name": "02724bf2", "displayName": "Page One", + "name": "02724bf2", "pageType": "PAGE_TYPE_CANVAS" } ] diff --git a/acceptance/bundle/deployment/bind/dashboard/recreation/output.txt b/acceptance/bundle/deployment/bind/dashboard/recreation/output.txt index f6ec933add..bab63ae4dd 100644 --- a/acceptance/bundle/deployment/bind/dashboard/recreation/output.txt +++ b/acceptance/bundle/deployment/bind/dashboard/recreation/output.txt @@ -26,6 +26,6 @@ Deployment complete! >>> [CLI] lakeview get [DASHBOARD_ID] { - "display_name": "test dashboard [UUID]", + "display_name": "test dashboard [UNIQUE_NAME]", "lifecycle_state": "ACTIVE" } diff --git a/acceptance/bundle/deployment/bind/dashboard/recreation/script b/acceptance/bundle/deployment/bind/dashboard/recreation/script index 8fc4825323..bff1482bd6 100644 --- a/acceptance/bundle/deployment/bind/dashboard/recreation/script +++ b/acceptance/bundle/deployment/bind/dashboard/recreation/script @@ -1,8 +1,4 @@ -DASHBOARD_DISPLAY_NAME="test dashboard $(uuid)" -if [ -z "$CLOUD_ENV" ]; then - DASHBOARD_DISPLAY_NAME="test dashboard 6260d50f-e8ff-4905-8f28-812345678903" # use hard-coded uuid when running locally - export TEST_DEFAULT_WAREHOUSE_ID="warehouse-1234" -fi +DASHBOARD_DISPLAY_NAME="test dashboard $UNIQUE_NAME" export DASHBOARD_DISPLAY_NAME envsubst < databricks.yml.tmpl > databricks.yml diff --git a/acceptance/bundle/deployment/bind/dashboard/script b/acceptance/bundle/deployment/bind/dashboard/script index ac15fdb1fd..ee59b588fd 100644 --- a/acceptance/bundle/deployment/bind/dashboard/script +++ b/acceptance/bundle/deployment/bind/dashboard/script @@ -1,8 +1,4 @@ -DASHBOARD_DISPLAY_NAME="test dashboard $(uuid)" -if [ -z "$CLOUD_ENV" ]; then - DASHBOARD_DISPLAY_NAME="test dashboard 6260d50f-e8ff-4905-8f28-812345678903" # use hard-coded uuid when running locally - export TEST_DEFAULT_WAREHOUSE_ID="warehouse-1234" -fi +DASHBOARD_DISPLAY_NAME="test dashboard $UNIQUE_NAME" export DASHBOARD_DISPLAY_NAME envsubst < databricks.yml.tmpl > databricks.yml @@ -19,11 +15,11 @@ trace $CLI bundle deployment bind dashboard1 "${DASHBOARD_ID}" --auto-approve trace $CLI bundle deploy -trace $CLI lakeview get "${DASHBOARD_ID}" | jq '{display_name, lifecycle_state, path, parent_path, serialized_dashboard} | .serialized_dashboard |= fromjson' +trace $CLI lakeview get "${DASHBOARD_ID}" | jq --sort-keys '{display_name, lifecycle_state, path, parent_path, serialized_dashboard} | .serialized_dashboard |= fromjson' trace $CLI bundle deployment unbind dashboard1 trace $CLI bundle destroy --auto-approve # Read the pre-defined dashboard again (expecting it still exists and is not deleted): -trace $CLI lakeview get "${DASHBOARD_ID}" | jq '{display_name, lifecycle_state, path, parent_path, serialized_dashboard} | .serialized_dashboard |= fromjson' +trace $CLI lakeview get "${DASHBOARD_ID}" | jq --sort-keys '{display_name, lifecycle_state, path, parent_path, serialized_dashboard} | .serialized_dashboard |= fromjson' diff --git a/acceptance/bundle/deployment/bind/dashboard/test.toml b/acceptance/bundle/deployment/bind/dashboard/test.toml index d9167c2183..b429aa38e2 100644 --- a/acceptance/bundle/deployment/bind/dashboard/test.toml +++ b/acceptance/bundle/deployment/bind/dashboard/test.toml @@ -2,40 +2,6 @@ Local = true Cloud = true RequiresWarehouse = true -Ignore = [ - "databricks.yml", -] - [[Repls]] Old = "[0-9a-f]{32}" New = "[DASHBOARD_ID]" - -[[Server]] -Pattern = "POST /api/2.0/lakeview/dashboards" -Response.Body = ''' -{ - "dashboard_id":"1234567890abcdef1234567890abcdef" -} -''' - -[[Server]] -Pattern = "POST /api/2.0/lakeview/dashboards/{dashboard_id}/published" - -[[Server]] -Pattern = "PATCH /api/2.0/lakeview/dashboards/{dashboard_id}" - -[[Server]] -Pattern = "GET /api/2.0/lakeview/dashboards/{dashboard_id}" -Response.Body = ''' -{ - "dashboard_id":"1234567890abcdef1234567890abcdef", - "display_name": "test dashboard 6260d50f-e8ff-4905-8f28-812345678903", - "lifecycle_state": "ACTIVE", - "path": "/Users/[USERNAME]/test dashboard [UUID].lvdash.json", - "parent_path": "/Users/tester@databricks.com", - "serialized_dashboard": "{\"pages\":[{\"name\":\"02724bf2\",\"displayName\":\"Page One\",\"pageType\":\"PAGE_TYPE_CANVAS\"}]}" -} -''' - -[[Server]] -Pattern = "DELETE /api/2.0/lakeview/dashboards/{dashboard_id}" diff --git a/acceptance/bundle/deployment/bind/experiment/output.txt b/acceptance/bundle/deployment/bind/experiment/output.txt index b783247880..00bf54ef46 100644 --- a/acceptance/bundle/deployment/bind/experiment/output.txt +++ b/acceptance/bundle/deployment/bind/experiment/output.txt @@ -12,7 +12,7 @@ Updating deployment state... Deployment complete! === Read the pre-defined experiment: { - "name": "/Users/[USERNAME]/test-experiment[UUID]", + "name": "/Users/[USERNAME]/test-experiment[UNIQUE_NAME]", "lifecycle_stage": "active" } @@ -24,7 +24,7 @@ Deleting files... Destroy complete! === Read the pre-defined experiment again (expecting it still exists and is not deleted): { - "name": "/Users/[USERNAME]/test-experiment[UUID]", + "name": "/Users/[USERNAME]/test-experiment[UNIQUE_NAME]", "lifecycle_stage": "active" } diff --git a/acceptance/bundle/deployment/bind/experiment/script b/acceptance/bundle/deployment/bind/experiment/script index 2b5c0b4b16..24fadc3fff 100644 --- a/acceptance/bundle/deployment/bind/experiment/script +++ b/acceptance/bundle/deployment/bind/experiment/script @@ -3,10 +3,7 @@ title "Bind experiment test:" title "Substitute variables in the template" # double slash at the start prevents Windows to apply replacements to the path -EXPERIMENT_NAME="//Workspace/Users/${CURRENT_USER_NAME}/test-experiment$(uuid)" -if [ -z "$CLOUD_ENV" ]; then - EXPERIMENT_NAME="//Workspace/Users/${CURRENT_USER_NAME}/test-experiment6260d50f-e8ff-4905-8f28-812345678903" # use hard-coded uuid when running locally -fi +EXPERIMENT_NAME="//Workspace/Users/${CURRENT_USER_NAME}/test-experiment$UNIQUE_NAME" export EXPERIMENT_NAME envsubst < databricks.yml.tmpl > databricks.yml diff --git a/acceptance/bundle/deployment/bind/experiment/test.toml b/acceptance/bundle/deployment/bind/experiment/test.toml index dc3409fb35..0e8c8a3840 100644 --- a/acceptance/bundle/deployment/bind/experiment/test.toml +++ b/acceptance/bundle/deployment/bind/experiment/test.toml @@ -1,28 +1,2 @@ Local = true Cloud = true - -[[Server]] -Pattern = "POST /api/2.0/mlflow/experiments/create" -Response.Body = ''' -{ - "experiment_id":"1234567890" -} -''' - -[[Server]] -Pattern = "GET /api/2.0/mlflow/experiments/get" -Response.Body = ''' -{ - "experiment_id": "1234567890", - "experiment": { - "name": "/Users/[USERNAME]/test-experiment6260d50f-e8ff-4905-8f28-812345678903", - "lifecycle_stage": "active" - } -} -''' - -[[Server]] -Pattern = "POST /api/2.0/mlflow/experiments/update" - -[[Server]] -Pattern = "POST /api/2.0/mlflow/experiments/delete" diff --git a/acceptance/bundle/deployment/bind/model-serving-endpoint/output.txt b/acceptance/bundle/deployment/bind/model-serving-endpoint/output.txt index 885d7cac7f..702a1c1718 100644 --- a/acceptance/bundle/deployment/bind/model-serving-endpoint/output.txt +++ b/acceptance/bundle/deployment/bind/model-serving-endpoint/output.txt @@ -4,11 +4,11 @@ bundle: resources: model_serving_endpoints: endpoint1: - name: test-endpoint-[UUID] + name: test-endpoint-[UNIQUE_NAME] ->>> [CLI] serving-endpoints create test-endpoint-[UUID] +>>> [CLI] serving-endpoints create test-endpoint-[UNIQUE_NAME] { - "name": "test-endpoint-[UUID]", + "name": "test-endpoint-[UNIQUE_NAME]", "permission_level": "CAN_MANAGE", "route_optimized": false, "state": { @@ -17,9 +17,9 @@ resources: } } ->>> [CLI] serving-endpoints get test-endpoint-[UUID] +>>> [CLI] serving-endpoints get test-endpoint-[UNIQUE_NAME] { - "name": "test-endpoint-[UUID]", + "name": "test-endpoint-[UNIQUE_NAME]", "permission_level": "CAN_MANAGE", "route_optimized": false, "state": { @@ -28,9 +28,9 @@ resources: } } ->>> [CLI] bundle deployment bind endpoint1 test-endpoint-[UUID] +>>> [CLI] bundle deployment bind endpoint1 test-endpoint-[UNIQUE_NAME] Updating deployment state... -Successfully bound model_serving_endpoint with an id 'test-endpoint-[UUID]' +Successfully bound model_serving_endpoint with an id 'test-endpoint-[UNIQUE_NAME]' Run 'bundle deploy' to deploy changes to your workspace >>> [CLI] bundle deploy @@ -39,9 +39,9 @@ Deploying resources... Updating deployment state... Deployment complete! ->>> [CLI] serving-endpoints get test-endpoint-[UUID] +>>> [CLI] serving-endpoints get test-endpoint-[UNIQUE_NAME] { - "name": "test-endpoint-[UUID]", + "name": "test-endpoint-[UNIQUE_NAME]", "permission_level": "CAN_MANAGE", "route_optimized": false, "state": { @@ -59,9 +59,9 @@ All files and directories at the following location will be deleted: /Workspace/ Deleting files... Destroy complete! ->>> [CLI] serving-endpoints get test-endpoint-[UUID] +>>> [CLI] serving-endpoints get test-endpoint-[UNIQUE_NAME] { - "name": "test-endpoint-[UUID]", + "name": "test-endpoint-[UNIQUE_NAME]", "permission_level": "CAN_MANAGE", "route_optimized": false, "state": { @@ -70,4 +70,4 @@ Destroy complete! } } ->>> [CLI] serving-endpoints delete test-endpoint-[UUID] +>>> [CLI] serving-endpoints delete test-endpoint-[UNIQUE_NAME] diff --git a/acceptance/bundle/deployment/bind/model-serving-endpoint/script b/acceptance/bundle/deployment/bind/model-serving-endpoint/script index 2fb220940a..100b70b29e 100644 --- a/acceptance/bundle/deployment/bind/model-serving-endpoint/script +++ b/acceptance/bundle/deployment/bind/model-serving-endpoint/script @@ -1,7 +1,4 @@ -ENDPOINT_NAME="test-endpoint-$(uuid)" -if [ -z "$CLOUD_ENV" ]; then - ENDPOINT_NAME="test-endpoint-6260d50f-e8ff-4905-8f28-812345678903" -fi +ENDPOINT_NAME="test-endpoint-$UNIQUE_NAME" export ENDPOINT_NAME envsubst < databricks.yml.tmpl > databricks.yml cat databricks.yml diff --git a/acceptance/bundle/deployment/bind/model-serving-endpoint/test.toml b/acceptance/bundle/deployment/bind/model-serving-endpoint/test.toml index 3134784e8f..0e8c8a3840 100644 --- a/acceptance/bundle/deployment/bind/model-serving-endpoint/test.toml +++ b/acceptance/bundle/deployment/bind/model-serving-endpoint/test.toml @@ -1,34 +1,2 @@ Local = true Cloud = true - -Ignore = [ - "databricks.yml", -] - -[[Server]] -Pattern = "POST /api/2.0/serving-endpoints" -Response.Body = ''' -{ - "name": "test-endpoint-6260d50f-e8ff-4905-8f28-812345678903" -} -''' - -[[Server]] -Pattern = "GET /api/2.0/serving-endpoints/" - -[[Server]] -Pattern = "GET /api/2.0/serving-endpoints/{endpoint_name}" -Response.Body = ''' -{ - "name": "test-endpoint-6260d50f-e8ff-4905-8f28-812345678903", - "permission_level": "CAN_MANAGE", - "route_optimized": false, - "state": { - "config_update": "NOT_UPDATING", - "ready": "NOT_READY" - } -} -''' - -[[Server]] -Pattern = "DELETE /api/2.0/serving-endpoints/{endpoint_name}" diff --git a/acceptance/bundle/deployment/bind/registered-model/output.txt b/acceptance/bundle/deployment/bind/registered-model/output.txt index 0c8b8cb86a..cda82ea075 100644 --- a/acceptance/bundle/deployment/bind/registered-model/output.txt +++ b/acceptance/bundle/deployment/bind/registered-model/output.txt @@ -4,19 +4,19 @@ bundle: resources: registered_models: model1: - name: test-registered-model-[UUID] + name: test-registered-model-[UNIQUE_NAME] catalog_name: main - schema_name: test-schema-rmodel-[UUID] + schema_name: test-schema-rmodel-[UNIQUE_NAME] ->>> [CLI] schemas create test-schema-rmodel-[UUID] main +>>> [CLI] schemas create test-schema-rmodel-[UNIQUE_NAME] main { - "full_name": "main.test-schema-rmodel-[UUID]", + "full_name": "main.test-schema-rmodel-[UNIQUE_NAME]", "catalog_name": "main" } ->>> [CLI] bundle deployment bind model1 main.test-schema-rmodel-[UUID].test-registered-model-[UUID] +>>> [CLI] bundle deployment bind model1 main.test-schema-rmodel-[UNIQUE_NAME].test-registered-model-[UNIQUE_NAME] Updating deployment state... -Successfully bound registered_model with an id 'main.test-schema-rmodel-[UUID].test-registered-model-[UUID]' +Successfully bound registered_model with an id 'main.test-schema-rmodel-[UNIQUE_NAME].test-registered-model-[UNIQUE_NAME]' Run 'bundle deploy' to deploy changes to your workspace >>> [CLI] bundle deploy @@ -25,11 +25,11 @@ Deploying resources... Updating deployment state... Deployment complete! ->>> [CLI] registered-models get main.test-schema-rmodel-[UUID].test-registered-model-[UUID] +>>> [CLI] registered-models get main.test-schema-rmodel-[UNIQUE_NAME].test-registered-model-[UNIQUE_NAME] { - "full_name": "main.test-schema-rmodel-[UUID].test-registered-model-[UUID]", - "schema_name": "test-schema-rmodel-[UUID]", - "name": "test-registered-model-[UUID]" + "full_name": "main.test-schema-rmodel-[UNIQUE_NAME].test-registered-model-[UNIQUE_NAME]", + "schema_name": "test-schema-rmodel-[UNIQUE_NAME]", + "name": "test-registered-model-[UNIQUE_NAME]" } >>> [CLI] bundle deployment unbind model1 @@ -41,13 +41,13 @@ All files and directories at the following location will be deleted: /Workspace/ Deleting files... Destroy complete! ->>> [CLI] registered-models get main.test-schema-rmodel-[UUID].test-registered-model-[UUID] +>>> [CLI] registered-models get main.test-schema-rmodel-[UNIQUE_NAME].test-registered-model-[UNIQUE_NAME] { - "full_name": "main.test-schema-rmodel-[UUID].test-registered-model-[UUID]", - "schema_name": "test-schema-rmodel-[UUID]", - "name": "test-registered-model-[UUID]" + "full_name": "main.test-schema-rmodel-[UNIQUE_NAME].test-registered-model-[UNIQUE_NAME]", + "schema_name": "test-schema-rmodel-[UNIQUE_NAME]", + "name": "test-registered-model-[UNIQUE_NAME]" } ->>> [CLI] registered-models delete main.test-schema-rmodel-[UUID].test-registered-model-[UUID] +>>> [CLI] registered-models delete main.test-schema-rmodel-[UNIQUE_NAME].test-registered-model-[UNIQUE_NAME] ->>> [CLI] schemas delete main.test-schema-rmodel-[UUID] +>>> [CLI] schemas delete main.test-schema-rmodel-[UNIQUE_NAME] diff --git a/acceptance/bundle/deployment/bind/registered-model/script b/acceptance/bundle/deployment/bind/registered-model/script index dbd388851c..2229197247 100644 --- a/acceptance/bundle/deployment/bind/registered-model/script +++ b/acceptance/bundle/deployment/bind/registered-model/script @@ -1,9 +1,5 @@ -SCHEMA_NAME="test-schema-rmodel-$(uuid)" -MODEL_NAME="test-registered-model-$(uuid)" -if [ -z "$CLOUD_ENV" ]; then - SCHEMA_NAME="test-schema-rmodel-6260d50f-e8ff-4905-8f28-812345678903" # use hard-coded uuid when running locally - MODEL_NAME="test-registered-model-6260d50f-e8ff-4905-8f28-812345678903" -fi +SCHEMA_NAME="test-schema-rmodel-$UNIQUE_NAME" +MODEL_NAME="test-registered-model-$UNIQUE_NAME" CATALOG_NAME=main export SCHEMA_NAME MODEL_NAME CATALOG_NAME envsubst < databricks.yml.tmpl > databricks.yml diff --git a/acceptance/bundle/deployment/bind/registered-model/test.toml b/acceptance/bundle/deployment/bind/registered-model/test.toml index d31c97328a..f5706bb0af 100644 --- a/acceptance/bundle/deployment/bind/registered-model/test.toml +++ b/acceptance/bundle/deployment/bind/registered-model/test.toml @@ -1,31 +1,3 @@ Local = true Cloud = true RequiresUnityCatalog = true - -Ignore = [ - "databricks.yml", -] - -[[Server]] -Pattern = "POST /api/2.1/unity-catalog/models" -Response.Body = ''' -{ - "full_name": "main.test-schema-rmodel-6260d50f-e8ff-4905-8f28-812345678903.test-registered-model-6260d50f-e8ff-4905-8f28-812345678903", - "schema_name": "test-schema-rmodel-6260d50f-e8ff-4905-8f28-812345678903", - "name": "test-registered-model-6260d50f-e8ff-4905-8f28-812345678903" -} -''' - -[[Server]] -Pattern = "GET /api/2.1/unity-catalog/models/{model_full_name}" -Response.Body = ''' -{ - "catalog_name": "main", - "full_name": "main.test-schema-rmodel-6260d50f-e8ff-4905-8f28-812345678903.test-registered-model-6260d50f-e8ff-4905-8f28-812345678903", - "schema_name": "test-schema-rmodel-6260d50f-e8ff-4905-8f28-812345678903", - "name": "test-registered-model-6260d50f-e8ff-4905-8f28-812345678903" -} -''' - -[[Server]] -Pattern = "DELETE /api/2.1/unity-catalog/models/{model_full_name}" diff --git a/acceptance/bundle/deployment/bind/secret-scope/output.txt b/acceptance/bundle/deployment/bind/secret-scope/output.txt index 2a0433bb17..fb0f3ac11f 100644 --- a/acceptance/bundle/deployment/bind/secret-scope/output.txt +++ b/acceptance/bundle/deployment/bind/secret-scope/output.txt @@ -1,9 +1,9 @@ ->>> [CLI] secrets create-scope test-secret-scope-[UUID] +>>> [CLI] secrets create-scope test-secret-scope-[UNIQUE_NAME] ->>> [CLI] bundle deployment bind secret_scope1 test-secret-scope-[UUID] --auto-approve +>>> [CLI] bundle deployment bind secret_scope1 test-secret-scope-[UNIQUE_NAME] --auto-approve Updating deployment state... -Successfully bound secret_scope with an id 'test-secret-scope-[UUID]' +Successfully bound secret_scope with an id 'test-secret-scope-[UNIQUE_NAME]' Run 'bundle deploy' to deploy changes to your workspace >>> [CLI] bundle deploy @@ -15,7 +15,7 @@ Deployment complete! >>> [CLI] secrets list-scopes -o json { "backend_type": "DATABRICKS", - "name": "test-secret-scope-[UUID]" + "name": "test-secret-scope-[UNIQUE_NAME]" } >>> [CLI] bundle deployment unbind secret_scope1 @@ -30,7 +30,7 @@ Destroy complete! >>> [CLI] secrets list-scopes -o json { "backend_type": "DATABRICKS", - "name": "test-secret-scope-[UUID]" + "name": "test-secret-scope-[UNIQUE_NAME]" } ->>> [CLI] secrets delete-scope test-secret-scope-[UUID] +>>> [CLI] secrets delete-scope test-secret-scope-[UNIQUE_NAME] diff --git a/acceptance/bundle/deployment/bind/secret-scope/script b/acceptance/bundle/deployment/bind/secret-scope/script index 1dd2233851..c4e80009e6 100644 --- a/acceptance/bundle/deployment/bind/secret-scope/script +++ b/acceptance/bundle/deployment/bind/secret-scope/script @@ -1,7 +1,4 @@ -SECRET_SCOPE_NAME="test-secret-scope-$(uuid)" -if [ -z "$CLOUD_ENV" ]; then - SECRET_SCOPE_NAME="test-secret-scope-6260d50f-e8ff-4905-8f28-812345678903" # use hard-coded uuid when running locally -fi +SECRET_SCOPE_NAME="test-secret-scope-$UNIQUE_NAME" export SECRET_SCOPE_NAME envsubst < databricks.yml.tmpl > databricks.yml diff --git a/acceptance/bundle/deployment/bind/secret-scope/test.toml b/acceptance/bundle/deployment/bind/secret-scope/test.toml index 3c38ba78fc..f5706bb0af 100644 --- a/acceptance/bundle/deployment/bind/secret-scope/test.toml +++ b/acceptance/bundle/deployment/bind/secret-scope/test.toml @@ -1,26 +1,3 @@ Local = true Cloud = true RequiresUnityCatalog = true - -Ignore = [ - "databricks.yml", -] - -[[Server]] -Pattern = "POST /api/2.0/secrets/scopes/create" - -[[Server]] -Pattern = "GET /api/2.0/secrets/scopes/list" -Response.Body = ''' -{ - "scopes": [ - { - "backend_type": "DATABRICKS", - "name": "test-secret-scope-6260d50f-e8ff-4905-8f28-812345678903" - } - ] -} -''' - -[[Server]] -Pattern = "POST /api/2.0/secrets/scopes/delete" diff --git a/acceptance/bundle/deployment/bind/volume/output.txt b/acceptance/bundle/deployment/bind/volume/output.txt index c7c18e5e33..b7938df143 100644 --- a/acceptance/bundle/deployment/bind/volume/output.txt +++ b/acceptance/bundle/deployment/bind/volume/output.txt @@ -1,14 +1,14 @@ ->>> [CLI] schemas create test-schema-[UUID] main +>>> [CLI] schemas create test-schema-[UNIQUE_NAME] main { - "full_name": "main.test-schema-[UUID]", + "full_name": "main.test-schema-[UNIQUE_NAME]", "catalog_name": "main" } === Create a pre-defined volume: ->>> [CLI] bundle deployment bind volume1 main.test-schema-[UUID].volume-[UUID] --auto-approve +>>> [CLI] bundle deployment bind volume1 main.test-schema-[UNIQUE_NAME].volume-[UNIQUE_NAME] --auto-approve Updating deployment state... -Successfully bound volume with an id 'main.test-schema-[UUID].volume-[UUID]' +Successfully bound volume with an id 'main.test-schema-[UNIQUE_NAME].volume-[UNIQUE_NAME]' Run 'bundle deploy' to deploy changes to your workspace >>> [CLI] bundle deploy @@ -17,11 +17,11 @@ Deploying resources... Updating deployment state... Deployment complete! ->>> [CLI] volumes read main.test-schema-[UUID].volume-[UUID] +>>> [CLI] volumes read main.test-schema-[UNIQUE_NAME].volume-[UNIQUE_NAME] { "catalog_name": "main", - "full_name": "main.test-schema-[UUID].volume-[UUID]", - "schema_name": "test-schema-[UUID]", + "full_name": "main.test-schema-[UNIQUE_NAME].volume-[UNIQUE_NAME]", + "schema_name": "test-schema-[UNIQUE_NAME]", "volume_type": "MANAGED" } @@ -34,10 +34,10 @@ All files and directories at the following location will be deleted: /Workspace/ Deleting files... Destroy complete! ->>> [CLI] volumes read main.test-schema-[UUID].volume-[UUID] +>>> [CLI] volumes read main.test-schema-[UNIQUE_NAME].volume-[UNIQUE_NAME] { "catalog_name": "main", - "full_name": "main.test-schema-[UUID].volume-[UUID]", - "schema_name": "test-schema-[UUID]", + "full_name": "main.test-schema-[UNIQUE_NAME].volume-[UNIQUE_NAME]", + "schema_name": "test-schema-[UNIQUE_NAME]", "volume_type": "MANAGED" } diff --git a/acceptance/bundle/deployment/bind/volume/script b/acceptance/bundle/deployment/bind/volume/script index 83d58fcf21..dee5352a83 100644 --- a/acceptance/bundle/deployment/bind/volume/script +++ b/acceptance/bundle/deployment/bind/volume/script @@ -1,9 +1,5 @@ -VOLUME_NAME="volume-$(uuid)" -SCHEMA_NAME="test-schema-$(uuid)" -if [ -z "$CLOUD_ENV" ]; then - VOLUME_NAME="volume-6260d50f-e8ff-4905-8f28-812345678903" # use hard-coded uuid when running locally - SCHEMA_NAME="test-schema-6260d50f-e8ff-4905-8f28-812345678903" -fi +VOLUME_NAME="volume-$UNIQUE_NAME" +SCHEMA_NAME="test-schema-$UNIQUE_NAME" export VOLUME_NAME export SCHEMA_NAME export CATALOG_NAME="main" diff --git a/acceptance/bundle/deployment/bind/volume/test.toml b/acceptance/bundle/deployment/bind/volume/test.toml index fe34f88ada..f5706bb0af 100644 --- a/acceptance/bundle/deployment/bind/volume/test.toml +++ b/acceptance/bundle/deployment/bind/volume/test.toml @@ -1,30 +1,3 @@ Local = true Cloud = true RequiresUnityCatalog = true - -Ignore = [ - "databricks.yml", -] - -[[Server]] -Pattern = "POST /api/2.1/unity-catalog/volumes" -Response.Body = ''' -{ - "full_name":"main.test-schema-6260d50f-e8ff-4905-8f28-812345678903.volume-6260d50f-e8ff-4905-8f28-812345678903" -} -''' - -[[Server]] -Pattern = "GET /api/2.1/unity-catalog/volumes/{volume_fullname}" -Response.Body = ''' -{ - "catalog_name": "main", - "schema_name": "test-schema-6260d50f-e8ff-4905-8f28-812345678903", - "name": "volume-6260d50f-e8ff-4905-8f28-812345678903", - "full_name": "main.test-schema-6260d50f-e8ff-4905-8f28-812345678903.volume-6260d50f-e8ff-4905-8f28-812345678903", - "volume_type": "MANAGED" -} -''' - -[[Server]] -Pattern = "DELETE /api/2.1/unity-catalog/volumes/{volume_fullname}" diff --git a/acceptance/bundle/resources/model_serving_endpoints/recreate/catalog-name/out.second-plan.direct.json b/acceptance/bundle/resources/model_serving_endpoints/recreate/catalog-name/out.second-plan.direct.json index d1702d89ac..c088210dfb 100644 --- a/acceptance/bundle/resources/model_serving_endpoints/recreate/catalog-name/out.second-plan.direct.json +++ b/acceptance/bundle/resources/model_serving_endpoints/recreate/catalog-name/out.second-plan.direct.json @@ -56,8 +56,11 @@ "creator": "[USERNAME]", "id": "[UUID]", "name": "[ORIGINAL_ENDPOINT_ID]", + "permission_level": "CAN_MANAGE", + "route_optimized": false, "state": { - "config_update": "NOT_UPDATING" + "config_update": "NOT_UPDATING", + "ready": "NOT_READY" } }, "endpoint_id": "[UUID]" @@ -69,6 +72,11 @@ "old": "main", "new": "other_catalog", "remote": "main" + }, + "route_optimized": { + "action": "skip", + "reason": "server_side_default", + "remote": false } } } diff --git a/acceptance/bundle/resources/model_serving_endpoints/recreate/name-change/out.second-plan.direct.json b/acceptance/bundle/resources/model_serving_endpoints/recreate/name-change/out.second-plan.direct.json index 189655b798..8ff0c151c6 100644 --- a/acceptance/bundle/resources/model_serving_endpoints/recreate/name-change/out.second-plan.direct.json +++ b/acceptance/bundle/resources/model_serving_endpoints/recreate/name-change/out.second-plan.direct.json @@ -46,8 +46,11 @@ "creator": "[USERNAME]", "id": "[UUID]", "name": "[ORIGINAL_ENDPOINT_ID]", + "permission_level": "CAN_MANAGE", + "route_optimized": false, "state": { - "config_update": "NOT_UPDATING" + "config_update": "NOT_UPDATING", + "ready": "NOT_READY" } }, "endpoint_id": "[UUID]" @@ -59,6 +62,11 @@ "old": "[ORIGINAL_ENDPOINT_ID]", "new": "[NEW_ENDPOINT_ID]", "remote": "[ORIGINAL_ENDPOINT_ID]" + }, + "route_optimized": { + "action": "skip", + "reason": "server_side_default", + "remote": false } } } diff --git a/acceptance/bundle/resources/model_serving_endpoints/recreate/route-optimized/out.first-get.terraform.json b/acceptance/bundle/resources/model_serving_endpoints/recreate/route-optimized/out.first-get.terraform.json index f4d7f8991f..f74ee87921 100644 --- a/acceptance/bundle/resources/model_serving_endpoints/recreate/route-optimized/out.first-get.terraform.json +++ b/acceptance/bundle/resources/model_serving_endpoints/recreate/route-optimized/out.first-get.terraform.json @@ -1,4 +1,4 @@ { - "route_optimized": null, + "route_optimized": false, "id": "[UUID]" } diff --git a/acceptance/bundle/resources/model_serving_endpoints/recreate/route-optimized/out.second-plan.direct.json b/acceptance/bundle/resources/model_serving_endpoints/recreate/route-optimized/out.second-plan.direct.json index 4f13fb7471..41ccbd543d 100644 --- a/acceptance/bundle/resources/model_serving_endpoints/recreate/route-optimized/out.second-plan.direct.json +++ b/acceptance/bundle/resources/model_serving_endpoints/recreate/route-optimized/out.second-plan.direct.json @@ -39,9 +39,11 @@ "creator": "[USERNAME]", "id": "[UUID]", "name": "[ORIGINAL_ENDPOINT_ID]", + "permission_level": "CAN_MANAGE", "route_optimized": false, "state": { - "config_update": "NOT_UPDATING" + "config_update": "NOT_UPDATING", + "ready": "NOT_READY" } }, "endpoint_id": "[UUID]" diff --git a/acceptance/bundle/resources/model_serving_endpoints/recreate/route-optimized/output.txt b/acceptance/bundle/resources/model_serving_endpoints/recreate/route-optimized/output.txt index ef381d946e..defc19c459 100644 --- a/acceptance/bundle/resources/model_serving_endpoints/recreate/route-optimized/output.txt +++ b/acceptance/bundle/resources/model_serving_endpoints/recreate/route-optimized/output.txt @@ -60,9 +60,11 @@ Deployment complete! "creator":"[USERNAME]", "id":"[UUID]", "name":"[ORIGINAL_ENDPOINT_ID]", + "permission_level":"CAN_MANAGE", "route_optimized":true, "state": { - "config_update":"NOT_UPDATING" + "config_update":"NOT_UPDATING", + "ready":"NOT_READY" } } diff --git a/acceptance/bundle/resources/model_serving_endpoints/recreate/schema-name/out.second-plan.direct.json b/acceptance/bundle/resources/model_serving_endpoints/recreate/schema-name/out.second-plan.direct.json index e6b484a7c3..8871726f08 100644 --- a/acceptance/bundle/resources/model_serving_endpoints/recreate/schema-name/out.second-plan.direct.json +++ b/acceptance/bundle/resources/model_serving_endpoints/recreate/schema-name/out.second-plan.direct.json @@ -56,8 +56,11 @@ "creator": "[USERNAME]", "id": "[UUID]", "name": "[ORIGINAL_ENDPOINT_ID]", + "permission_level": "CAN_MANAGE", + "route_optimized": false, "state": { - "config_update": "NOT_UPDATING" + "config_update": "NOT_UPDATING", + "ready": "NOT_READY" } }, "endpoint_id": "[UUID]" @@ -69,6 +72,11 @@ "old": "default", "new": "other_schema", "remote": "default" + }, + "route_optimized": { + "action": "skip", + "reason": "server_side_default", + "remote": false } } } diff --git a/acceptance/bundle/resources/model_serving_endpoints/recreate/table-prefix/out.second-plan.direct.json b/acceptance/bundle/resources/model_serving_endpoints/recreate/table-prefix/out.second-plan.direct.json index c599e2cf79..332be30a1a 100644 --- a/acceptance/bundle/resources/model_serving_endpoints/recreate/table-prefix/out.second-plan.direct.json +++ b/acceptance/bundle/resources/model_serving_endpoints/recreate/table-prefix/out.second-plan.direct.json @@ -56,8 +56,11 @@ "creator": "[USERNAME]", "id": "[UUID]", "name": "[ORIGINAL_ENDPOINT_ID]", + "permission_level": "CAN_MANAGE", + "route_optimized": false, "state": { - "config_update": "NOT_UPDATING" + "config_update": "NOT_UPDATING", + "ready": "NOT_READY" } }, "endpoint_id": "[UUID]" @@ -69,6 +72,11 @@ "old": "my_table", "new": "other_table", "remote": "my_table" + }, + "route_optimized": { + "action": "skip", + "reason": "server_side_default", + "remote": false } } } diff --git a/acceptance/bundle/resources/model_serving_endpoints/update/ai-gateway/out.plan.direct.json b/acceptance/bundle/resources/model_serving_endpoints/update/ai-gateway/out.plan.direct.json index a5dfcefaf6..7b88482bc6 100644 --- a/acceptance/bundle/resources/model_serving_endpoints/update/ai-gateway/out.plan.direct.json +++ b/acceptance/bundle/resources/model_serving_endpoints/update/ai-gateway/out.plan.direct.json @@ -56,8 +56,11 @@ "creator": "[USERNAME]", "id": "[UUID]", "name": "[ENDPOINT_ID]", + "permission_level": "CAN_MANAGE", + "route_optimized": false, "state": { - "config_update": "NOT_UPDATING" + "config_update": "NOT_UPDATING", + "ready": "NOT_READY" } }, "endpoint_id": "[UUID]" @@ -68,6 +71,11 @@ "old": "first-inference-catalog", "new": "second-inference-catalog", "remote": "first-inference-catalog" + }, + "route_optimized": { + "action": "skip", + "reason": "server_side_default", + "remote": false } } } diff --git a/acceptance/bundle/resources/model_serving_endpoints/update/both_gateway_and_tags/out.plan.direct.json b/acceptance/bundle/resources/model_serving_endpoints/update/both_gateway_and_tags/out.plan.direct.json index 5046a7bead..ddfcf8bb0c 100644 --- a/acceptance/bundle/resources/model_serving_endpoints/update/both_gateway_and_tags/out.plan.direct.json +++ b/acceptance/bundle/resources/model_serving_endpoints/update/both_gateway_and_tags/out.plan.direct.json @@ -62,8 +62,11 @@ "creator": "[USERNAME]", "id": "[UUID]", "name": "[ENDPOINT_ID]", + "permission_level": "CAN_MANAGE", + "route_optimized": false, "state": { - "config_update": "NOT_UPDATING" + "config_update": "NOT_UPDATING", + "ready": "NOT_READY" }, "tags": [ { @@ -81,6 +84,11 @@ "new": "second-inference-catalog", "remote": "first-inference-catalog" }, + "route_optimized": { + "action": "skip", + "reason": "server_side_default", + "remote": false + }, "tags[0].value": { "action": "update", "old": "my-team-one", diff --git a/acceptance/bundle/resources/model_serving_endpoints/update/config/out.plan.direct.json b/acceptance/bundle/resources/model_serving_endpoints/update/config/out.plan.direct.json index dfd2489bab..08517c1631 100644 --- a/acceptance/bundle/resources/model_serving_endpoints/update/config/out.plan.direct.json +++ b/acceptance/bundle/resources/model_serving_endpoints/update/config/out.plan.direct.json @@ -46,8 +46,11 @@ "creator": "[USERNAME]", "id": "[UUID]", "name": "[ENDPOINT_ID]", + "permission_level": "CAN_MANAGE", + "route_optimized": false, "state": { - "config_update": "NOT_UPDATING" + "config_update": "NOT_UPDATING", + "ready": "NOT_READY" } }, "endpoint_id": "[UUID]" @@ -58,6 +61,11 @@ "old": "gpt-4o-mini", "new": "gpt-5o-mini", "remote": "gpt-4o-mini" + }, + "route_optimized": { + "action": "skip", + "reason": "server_side_default", + "remote": false } } } diff --git a/acceptance/bundle/resources/model_serving_endpoints/update/email-notifications/out.plan.direct.json b/acceptance/bundle/resources/model_serving_endpoints/update/email-notifications/out.plan.direct.json index 222c460ad4..7271c7bc88 100644 --- a/acceptance/bundle/resources/model_serving_endpoints/update/email-notifications/out.plan.direct.json +++ b/acceptance/bundle/resources/model_serving_endpoints/update/email-notifications/out.plan.direct.json @@ -56,8 +56,11 @@ }, "id": "[UUID]", "name": "[ENDPOINT_ID]", + "permission_level": "CAN_MANAGE", + "route_optimized": false, "state": { - "config_update": "NOT_UPDATING" + "config_update": "NOT_UPDATING", + "ready": "NOT_READY" } }, "endpoint_id": "[UUID]" @@ -68,6 +71,11 @@ "old": "user1@example.com", "new": "user2@example.com", "remote": "user1@example.com" + }, + "route_optimized": { + "action": "skip", + "reason": "server_side_default", + "remote": false } } } diff --git a/acceptance/bundle/resources/model_serving_endpoints/update/tags/out.plan.direct.json b/acceptance/bundle/resources/model_serving_endpoints/update/tags/out.plan.direct.json index 1ee28ddf47..1ebc2142e2 100644 --- a/acceptance/bundle/resources/model_serving_endpoints/update/tags/out.plan.direct.json +++ b/acceptance/bundle/resources/model_serving_endpoints/update/tags/out.plan.direct.json @@ -52,8 +52,11 @@ "creator": "[USERNAME]", "id": "[UUID]", "name": "[ENDPOINT_ID]", + "permission_level": "CAN_MANAGE", + "route_optimized": false, "state": { - "config_update": "NOT_UPDATING" + "config_update": "NOT_UPDATING", + "ready": "NOT_READY" }, "tags": [ { @@ -65,6 +68,11 @@ "endpoint_id": "[UUID]" }, "changes": { + "route_optimized": { + "action": "skip", + "reason": "server_side_default", + "remote": false + }, "tags[0].value": { "action": "update", "old": "my-team-one", diff --git a/acceptance/bundle/resources/permissions/experiments/current_can_manage/out.requests.deploy.direct.json b/acceptance/bundle/resources/permissions/experiments/current_can_manage/out.requests.deploy.direct.json index fff1423cb6..a8085e0a92 100644 --- a/acceptance/bundle/resources/permissions/experiments/current_can_manage/out.requests.deploy.direct.json +++ b/acceptance/bundle/resources/permissions/experiments/current_can_manage/out.requests.deploy.direct.json @@ -1,6 +1,6 @@ { "method": "PUT", - "path": "/api/2.0/permissions/experiments/1000", + "path": "/api/2.0/permissions/experiments/[NUMID]", "body": { "access_control_list": [ { diff --git a/acceptance/bundle/resources/permissions/experiments/current_can_manage/out.requests.deploy.terraform.json b/acceptance/bundle/resources/permissions/experiments/current_can_manage/out.requests.deploy.terraform.json index 3013b391b3..e0c5cfe5a9 100644 --- a/acceptance/bundle/resources/permissions/experiments/current_can_manage/out.requests.deploy.terraform.json +++ b/acceptance/bundle/resources/permissions/experiments/current_can_manage/out.requests.deploy.terraform.json @@ -1,6 +1,6 @@ { "method": "PUT", - "path": "/api/2.0/permissions/experiments/1000", + "path": "/api/2.0/permissions/experiments/[NUMID]", "body": { "access_control_list": [ { diff --git a/acceptance/bundle/resources/permissions/experiments/current_can_manage/out.requests.destroy.terraform.json b/acceptance/bundle/resources/permissions/experiments/current_can_manage/out.requests.destroy.terraform.json index 636fcf8c06..d1d042a297 100644 --- a/acceptance/bundle/resources/permissions/experiments/current_can_manage/out.requests.destroy.terraform.json +++ b/acceptance/bundle/resources/permissions/experiments/current_can_manage/out.requests.destroy.terraform.json @@ -1,5 +1,5 @@ { "method": "PUT", - "path": "/api/2.0/permissions/experiments/1000", + "path": "/api/2.0/permissions/experiments/[NUMID]", "body": {} } diff --git a/acceptance/bundle/resources/permissions/output.txt b/acceptance/bundle/resources/permissions/output.txt index 0b0c55cc46..ed3f0ac83e 100644 --- a/acceptance/bundle/resources/permissions/output.txt +++ b/acceptance/bundle/resources/permissions/output.txt @@ -96,7 +96,7 @@ DIFF experiments/current_can_manage/out.requests.destroy.direct.json + { + "body": {}, + "method": "PUT", -+ "path": "/api/2.0/permissions/experiments/1000" ++ "path": "/api/2.0/permissions/experiments/[NUMID]" + } +] MATCH jobs/current_can_manage/out.requests.deploy.direct.json diff --git a/acceptance/cmd/workspace/create-scope/output.txt b/acceptance/cmd/workspace/create-scope/output.txt index eb551c2f50..4487d2945c 100644 --- a/acceptance/cmd/workspace/create-scope/output.txt +++ b/acceptance/cmd/workspace/create-scope/output.txt @@ -17,6 +17,8 @@ Warning: unknown field: keyvault_metadata in (inline):4:4 +>>> [CLI] secrets delete-scope xxxxxxxx-xxx + >>> [CLI] secrets create-scope --scope-backend-type AZURE_KEYVAULT --json { "scope": "xxxxxxxx-xxx", "scope_backend_type": "AZURE_KEYVAULT" diff --git a/acceptance/cmd/workspace/create-scope/script b/acceptance/cmd/workspace/create-scope/script index fd73e177bf..240af51bc4 100644 --- a/acceptance/cmd/workspace/create-scope/script +++ b/acceptance/cmd/workspace/create-scope/script @@ -11,6 +11,8 @@ trace $CLI secrets create-scope --scope-backend-type AZURE_KEYVAULT --json '{ } }' +trace $CLI secrets delete-scope xxxxxxxx-xxx + trace $CLI secrets create-scope --scope-backend-type AZURE_KEYVAULT --json '{ "scope": "xxxxxxxx-xxx", "scope_backend_type": "AZURE_KEYVAULT" diff --git a/acceptance/cmd/workspace/create-scope/test.toml b/acceptance/cmd/workspace/create-scope/test.toml index 718e5860b1..7d36fb9dc1 100644 --- a/acceptance/cmd/workspace/create-scope/test.toml +++ b/acceptance/cmd/workspace/create-scope/test.toml @@ -1,10 +1,2 @@ Local = true Cloud = false - -[[Server]] -Pattern = "POST /api/2.0/secrets/scopes/create" -Response.Body = ''' -{ - "scope": "xxxxxxxx-xxx" -} -''' diff --git a/acceptance/workspace/jobs/create/output.txt b/acceptance/workspace/jobs/create/output.txt index 50b823aa06..5f80243baa 100644 --- a/acceptance/workspace/jobs/create/output.txt +++ b/acceptance/workspace/jobs/create/output.txt @@ -1,5 +1,5 @@ >>> [CLI] jobs create --json {"name":"abc"} { - "job_id":1111 + "job_id":[NUMID] } diff --git a/acceptance/workspace/jobs/create/test.toml b/acceptance/workspace/jobs/create/test.toml index 7a1cbef2b3..93693c439d 100644 --- a/acceptance/workspace/jobs/create/test.toml +++ b/acceptance/workspace/jobs/create/test.toml @@ -1,14 +1,6 @@ RecordRequests = true IncludeRequestHeaders = ["Authorization", "User-Agent"] -[[Server]] -Pattern = "POST /api/2.2/jobs/create" -Response.Body = ''' -{ - "job_id": 1111 -} -''' - [[Repls]] Old = "(linux|darwin|windows)" New = "[OS]" diff --git a/libs/testserver/dashboards.go b/libs/testserver/dashboards.go index c07a8281c8..4025e99860 100644 --- a/libs/testserver/dashboards.go +++ b/libs/testserver/dashboards.go @@ -74,6 +74,11 @@ func (s *FakeWorkspace) DashboardCreate(req Request) Response { } } + // Default to user's home directory if parent_path is not provided (matches cloud behavior) + if dashboard.ParentPath == "" { + dashboard.ParentPath = "/Users/" + s.CurrentUser().UserName + } + if _, ok := s.directories[dashboard.ParentPath]; !ok { return Response{ StatusCode: 404, diff --git a/libs/testserver/experiments.go b/libs/testserver/experiments.go index d9d8d86f20..166e4b842d 100644 --- a/libs/testserver/experiments.go +++ b/libs/testserver/experiments.go @@ -5,6 +5,7 @@ import ( "fmt" "net/http" "strconv" + "strings" "github.com/databricks/databricks-sdk-go/service/ml" ) @@ -47,12 +48,22 @@ func (s *FakeWorkspace) ExperimentCreate(req Request) Response { }, } - experimentId := strconv.Itoa(len(s.Experiments) + 1000) + experimentId := strconv.FormatInt(nextID(), 10) + + // Strip /Workspace prefix from experiment name to match cloud behavior + // Input: //Workspace/Users/foo -> Output: /Users/foo + experimentName := experiment.Name + // Remove double slash used for Windows compatibility + if strings.HasPrefix(experimentName, "//") { + experimentName = strings.TrimPrefix(experimentName, "/") + } + // Remove /Workspace prefix + experimentName = strings.TrimPrefix(experimentName, "/Workspace") // Create the experiment exp := ml.Experiment{ ExperimentId: experimentId, - Name: experiment.Name, + Name: experimentName, ArtifactLocation: experiment.ArtifactLocation, Tags: append(experiment.Tags, appendTags...), LifecycleStage: "active", diff --git a/libs/testserver/fake_workspace.go b/libs/testserver/fake_workspace.go index 23cb275a5e..6c8d1bbf58 100644 --- a/libs/testserver/fake_workspace.go +++ b/libs/testserver/fake_workspace.go @@ -31,6 +31,8 @@ const ( UserNameTokenPrefix = "dbapi0" ServicePrincipalTokenPrefix = "dbapi1" UserID = "1000012345" + TestDefaultClusterId = "0123-456789-cluster0" + TestDefaultWarehouseId = "8ec9edc1-db0c-40df-af8d-7580020fe61e" ) var TestUser = iam.User{ @@ -218,24 +220,45 @@ func NewFakeWorkspace(url, token string) *FakeWorkspace { Path: "/Workspace", ObjectId: nextID(), }, + "/Users": { + ObjectType: "DIRECTORY", + Path: "/Users", + ObjectId: nextID(), + }, + "/Users/" + TestUser.UserName: { + ObjectType: "DIRECTORY", + Path: "/Users/" + TestUser.UserName, + ObjectId: nextID(), + }, + "/Users/" + TestUserSP.UserName: { + ObjectType: "DIRECTORY", + Path: "/Users/" + TestUserSP.UserName, + ObjectId: nextID(), + }, }, files: make(map[string]FileEntry), repoIdByPath: make(map[string]int64), - Jobs: map[int64]jobs.Job{}, - JobRuns: map[int64]jobs.Run{}, - Grants: map[string][]catalog.PrivilegeAssignment{}, - Pipelines: map[string]pipelines.GetPipelineResponse{}, - PipelineUpdates: map[string]bool{}, - Monitors: map[string]catalog.MonitorInfo{}, - Apps: map[string]apps.App{}, - Catalogs: map[string]catalog.CatalogInfo{}, - Schemas: map[string]catalog.SchemaInfo{}, - RegisteredModels: map[string]catalog.RegisteredModelInfo{}, - Volumes: map[string]catalog.VolumeInfo{}, - Dashboards: map[string]fakeDashboard{}, - PublishedDashboards: map[string]dashboards.PublishedDashboard{}, - SqlWarehouses: map[string]sql.GetWarehouseResponse{}, + Jobs: map[int64]jobs.Job{}, + JobRuns: map[int64]jobs.Run{}, + Grants: map[string][]catalog.PrivilegeAssignment{}, + Pipelines: map[string]pipelines.GetPipelineResponse{}, + PipelineUpdates: map[string]bool{}, + Monitors: map[string]catalog.MonitorInfo{}, + Apps: map[string]apps.App{}, + Catalogs: map[string]catalog.CatalogInfo{}, + Schemas: map[string]catalog.SchemaInfo{}, + RegisteredModels: map[string]catalog.RegisteredModelInfo{}, + Volumes: map[string]catalog.VolumeInfo{}, + Dashboards: map[string]fakeDashboard{}, + PublishedDashboards: map[string]dashboards.PublishedDashboard{}, + SqlWarehouses: map[string]sql.GetWarehouseResponse{ + TestDefaultWarehouseId: { + Id: TestDefaultWarehouseId, + Name: "DEFAULT Test SQL Warehouse", + State: sql.StateRunning, + }, + }, ServingEndpoints: map[string]serving.ServingEndpointDetailed{}, Repos: map[string]workspace.RepoInfo{}, SecretScopes: map[string]workspace.SecretScope{}, @@ -249,7 +272,12 @@ func NewFakeWorkspace(url, token string) *FakeWorkspace { Alerts: map[string]sql.AlertV2{}, Experiments: map[string]ml.GetExperimentResponse{}, ModelRegistryModels: map[string]ml.Model{}, - Clusters: map[string]compute.ClusterDetails{}, + Clusters: map[string]compute.ClusterDetails{ + TestDefaultClusterId: { + ClusterId: TestDefaultClusterId, + ClusterName: "DEFAULT Test Cluster", + }, + }, } } diff --git a/libs/testserver/serving_endpoints.go b/libs/testserver/serving_endpoints.go index 86dfc4babe..c0531d5ef1 100644 --- a/libs/testserver/serving_endpoints.go +++ b/libs/testserver/serving_endpoints.go @@ -114,12 +114,14 @@ func (s *FakeWorkspace) ServingEndpointCreate(req Request) Response { EmailNotifications: createReq.EmailNotifications, Id: nextUUID(), Name: createReq.Name, + PermissionLevel: serving.ServingEndpointDetailedPermissionLevelCanManage, RouteOptimized: createReq.RouteOptimized, Tags: createReq.Tags, State: &serving.EndpointState{ ConfigUpdate: serving.EndpointStateConfigUpdateNotUpdating, + Ready: serving.EndpointStateReadyNotReady, }, - ForceSendFields: createReq.ForceSendFields, + ForceSendFields: append(createReq.ForceSendFields, "PermissionLevel", "RouteOptimized"), } s.ServingEndpoints[createReq.Name] = endpoint @@ -175,6 +177,7 @@ func (s *FakeWorkspace) ServingEndpointUpdate(req Request, name string) Response endpoint.Config = config endpoint.State = &serving.EndpointState{ ConfigUpdate: serving.EndpointStateConfigUpdateNotUpdating, + Ready: serving.EndpointStateReadyNotReady, } s.ServingEndpoints[name] = endpoint