mirror of https://github.com/databricks/cli.git
Add acceptance test for binding/unbinding schemas
This commit is contained in:
parent
edf37e7d0d
commit
a02dcfdbde
|
@ -0,0 +1,10 @@
|
|||
bundle:
|
||||
name: bind-schema-test-$BUNDLE_UUID
|
||||
|
||||
resources:
|
||||
schemas:
|
||||
schema1:
|
||||
name: $SCHEMA_NAME
|
||||
catalog_name: main
|
||||
comment: This schema was created from DABs
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
|
||||
=== Bind schema test:
|
||||
=== Substitute variables in the template:
|
||||
=== Create a pre-defined schema: {
|
||||
"full_name": "main.test-schema-[UUID]",
|
||||
"catalog_name": "main",
|
||||
"comment": null
|
||||
}
|
||||
|
||||
=== Bind schema: Updating deployment state...
|
||||
Successfully bound databricks_schema with an id 'main.test-schema-[UUID]'. Run 'bundle deploy' to deploy changes to your workspace
|
||||
|
||||
=== Deploy bundle: Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/bind-schema-test-[UUID]/default/files...
|
||||
Deploying resources...
|
||||
Updating deployment state...
|
||||
Deployment complete!
|
||||
|
||||
=== Read the pre-defined schema: {
|
||||
"full_name": "main.test-schema-[UUID]",
|
||||
"catalog_name": "main",
|
||||
"comment": "This schema was created from DABs"
|
||||
}
|
||||
|
||||
=== Unbind the schema: Updating deployment state...
|
||||
|
||||
=== Destroy the bundle: All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/bind-schema-test-[UUID]/default
|
||||
|
||||
Deleting files...
|
||||
Destroy complete!
|
||||
|
||||
=== Read the pre-defined schema again (expecting it still exists): {
|
||||
"full_name": "main.test-schema-[UUID]",
|
||||
"catalog_name": "main",
|
||||
"comment": "This schema was created from DABs"
|
||||
}
|
||||
|
||||
=== Test cleanup:
|
||||
=== Delete the pre-defined schema: 0
|
|
@ -0,0 +1,33 @@
|
|||
title "Bind schema test: "
|
||||
|
||||
title "Substitute variables in the template: "
|
||||
export BUNDLE_UUID=$(uuid)
|
||||
export SCHEMA_NAME="test-schema-$(uuid)"
|
||||
envsubst < databricks.yml > out.yml && mv out.yml databricks.yml
|
||||
|
||||
title "Create a pre-defined schema: "
|
||||
CATALOG_NAME=main
|
||||
$CLI schemas create ${SCHEMA_NAME} ${CATALOG_NAME} | jq '{full_name, catalog_name, comment}'
|
||||
|
||||
title "Bind schema: "
|
||||
$CLI bundle deployment bind schema1 ${CATALOG_NAME}.${SCHEMA_NAME} --auto-approve
|
||||
|
||||
title "Deploy bundle: "
|
||||
$CLI bundle deploy --force-lock --auto-approve
|
||||
|
||||
title "Read the pre-defined schema: "
|
||||
$CLI schemas get ${CATALOG_NAME}.${SCHEMA_NAME} | jq '{full_name, catalog_name, comment}'
|
||||
|
||||
title "Unbind the schema: "
|
||||
$CLI bundle deployment unbind schema1
|
||||
|
||||
title "Destroy the bundle: "
|
||||
$CLI bundle destroy --auto-approve
|
||||
|
||||
title "Read the pre-defined schema again (expecting it still exists): "
|
||||
$CLI schemas get ${CATALOG_NAME}.${SCHEMA_NAME} | jq '{full_name, catalog_name, comment}'
|
||||
|
||||
title "Test cleanup: "
|
||||
title "Delete the pre-defined schema: "
|
||||
$CLI schemas delete ${CATALOG_NAME}.${SCHEMA_NAME}
|
||||
echo $?
|
|
@ -0,0 +1,2 @@
|
|||
Cloud = true
|
||||
Local = false
|
|
@ -59,3 +59,7 @@ withdir() {
|
|||
cd "$orig_dir" || return $?
|
||||
return $exit_code
|
||||
}
|
||||
|
||||
uuid() {
|
||||
python3 -c 'import uuid; print(uuid.uuid4())'
|
||||
}
|
Loading…
Reference in New Issue