mirror of https://github.com/databricks/cli.git
remove the schema inside a trap function in order to run it even if main script exits prematurely
This commit is contained in:
parent
d789e48d07
commit
faf387753d
|
@ -35,4 +35,4 @@ Destroy complete!
|
||||||
}
|
}
|
||||||
|
|
||||||
=== Test cleanup:
|
=== Test cleanup:
|
||||||
=== Delete the pre-defined schema: 0
|
=== Delete the pre-defined schema test-schema-[UUID]: 0
|
||||||
|
|
|
@ -9,6 +9,14 @@ title "Create a pre-defined schema: "
|
||||||
CATALOG_NAME=main
|
CATALOG_NAME=main
|
||||||
$CLI schemas create ${SCHEMA_NAME} ${CATALOG_NAME} | jq '{full_name, catalog_name, comment}'
|
$CLI schemas create ${SCHEMA_NAME} ${CATALOG_NAME} | jq '{full_name, catalog_name, comment}'
|
||||||
|
|
||||||
|
cleanupRemoveSchema() {
|
||||||
|
title "Test cleanup: "
|
||||||
|
title "Delete the pre-defined schema ${SCHEMA_NAME}: "
|
||||||
|
$CLI schemas delete ${CATALOG_NAME}.${SCHEMA_NAME}
|
||||||
|
echo $?
|
||||||
|
}
|
||||||
|
trap cleanupRemoveSchema EXIT
|
||||||
|
|
||||||
title "Bind schema: "
|
title "Bind schema: "
|
||||||
$CLI bundle deployment bind schema1 ${CATALOG_NAME}.${SCHEMA_NAME} --auto-approve
|
$CLI bundle deployment bind schema1 ${CATALOG_NAME}.${SCHEMA_NAME} --auto-approve
|
||||||
|
|
||||||
|
@ -26,8 +34,3 @@ $CLI bundle destroy --auto-approve
|
||||||
|
|
||||||
title "Read the pre-defined schema again (expecting it still exists): "
|
title "Read the pre-defined schema again (expecting it still exists): "
|
||||||
$CLI schemas get ${CATALOG_NAME}.${SCHEMA_NAME} | jq '{full_name, catalog_name, comment}'
|
$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 $?
|
|
Loading…
Reference in New Issue