diff --git a/acceptance/bundle/resources/synced_database_tables/basic/databricks.yml.tmpl b/acceptance/bundle/resources/synced_database_tables/basic/databricks.yml.tmpl index 17c069a0a63..39686a76e91 100644 --- a/acceptance/bundle/resources/synced_database_tables/basic/databricks.yml.tmpl +++ b/acceptance/bundle/resources/synced_database_tables/basic/databricks.yml.tmpl @@ -18,7 +18,8 @@ resources: database_instance_name: ${resources.database_instances.my_instance.name} logical_database_name: ${resources.database_catalogs.my_catalog.database_name} spec: - source_table_full_name: "samples.nyctaxi.trips" + # Use a unique source table per test run to avoid hitting the 20-table-per-source limit + source_table_full_name: "main.test_synced_$UNIQUE_NAME.trips_source" scheduling_policy: SNAPSHOT primary_key_columns: - tpep_pickup_datetime diff --git a/acceptance/bundle/resources/synced_database_tables/basic/output.txt b/acceptance/bundle/resources/synced_database_tables/basic/output.txt index 4d6eae9eca3..7e8871433fd 100644 --- a/acceptance/bundle/resources/synced_database_tables/basic/output.txt +++ b/acceptance/bundle/resources/synced_database_tables/basic/output.txt @@ -1,3 +1,7 @@ +Creating temporary source table: main.test_synced_[UNIQUE_NAME].trips_source +{ + "full_name": "main.test_synced_[UNIQUE_NAME]" +} >>> [CLI] bundle summary Name: deploy-lakebase-synced-table-[UNIQUE_NAME] @@ -50,3 +54,4 @@ All files and directories at the following location will be deleted: /Workspace/ Deleting files... Destroy complete! +Cleaning up temporary source table diff --git a/acceptance/bundle/resources/synced_database_tables/basic/script b/acceptance/bundle/resources/synced_database_tables/basic/script index 081a88e44ae..4aa11ab8491 100644 --- a/acceptance/bundle/resources/synced_database_tables/basic/script +++ b/acceptance/bundle/resources/synced_database_tables/basic/script @@ -1,7 +1,23 @@ envsubst < databricks.yml.tmpl > databricks.yml +# Create a unique source table for this test run to avoid hitting the 20-table-per-source limit +echo "Creating temporary source table: main.test_synced_$UNIQUE_NAME.trips_source" +# Create schema using CLI +$CLI schemas create test_synced_$UNIQUE_NAME main -o json | jq '{full_name}' +# Create source table from samples.nyctaxi.trips using SQL API +# MSYS_NO_PATHCONV=1 prevents Git Bash on Windows from converting /api/... to C:/Program Files/Git/api/... +MSYS_NO_PATHCONV=1 $CLI api post "/api/2.0/sql/statements/" --json "{ + \"warehouse_id\": \"$TEST_DEFAULT_WAREHOUSE_ID\", + \"statement\": \"CREATE TABLE main.test_synced_$UNIQUE_NAME.trips_source AS SELECT * FROM samples.nyctaxi.trips LIMIT 10\", + \"wait_timeout\": \"45s\" + }" > /dev/null + cleanup() { trace $CLI bundle destroy --auto-approve + # Clean up the temporary source table + echo "Cleaning up temporary source table" + $CLI tables delete main.test_synced_$UNIQUE_NAME.trips_source || true + $CLI schemas delete main.test_synced_$UNIQUE_NAME || true } trap cleanup EXIT diff --git a/acceptance/bundle/resources/synced_database_tables/basic/test.toml b/acceptance/bundle/resources/synced_database_tables/basic/test.toml index 4d387819d23..d2bbdeaa58c 100644 --- a/acceptance/bundle/resources/synced_database_tables/basic/test.toml +++ b/acceptance/bundle/resources/synced_database_tables/basic/test.toml @@ -9,3 +9,12 @@ RecordRequests = false Old = '\?o=\[(NUMID|ALPHANUMID)\]' New = '' Order = 1000 + +# Fake SQL endpoint for local tests +[[Server]] +Pattern = "POST /api/2.0/sql/statements/" +Response.Body = '{"status": {"state": "SUCCEEDED"}, "manifest": {"schema": {"columns": []}}}' + +[[Server]] +Pattern = "DELETE /api/2.1/unity-catalog/tables/{name}" +Response.Body = '{"status": "OK"}'