Skip to content

Commit 3f8b827

Browse files
committed
Extend dataset_catalog and dataset_schema support to Terraform engine
- Add Terraform conversion test for dataset_catalog and dataset_schema - Update acceptance tests to run for both direct and terraform engines - Fix direct engine to skip write-only fields in remote diff computation - Add engine-specific expected output files for requests and plans - Update test script to generate engine-specific request files
1 parent a49a0ee commit 3f8b827

File tree

12 files changed

+125
-27
lines changed

12 files changed

+125
-27
lines changed
Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,45 @@
11
{
2-
"all_resources": [
3-
{
4-
"resource_type": "databricks_dashboard",
5-
"resource_key": "dashboard1",
6-
"action": "noop"
2+
"plan_version": 1,
3+
"cli_version": "[DEV_VERSION]",
4+
"plan": {
5+
"resources.dashboards.dashboard1": {
6+
"action": "skip",
7+
"remote_state": {
8+
"create_time": "[TIMESTAMP]",
9+
"dashboard_id": "[DASHBOARD_ID]",
10+
"display_name": "test bundle-deploy-dashboard-dataset [UUID]",
11+
"embed_credentials": true,
12+
"etag": [ETAG],
13+
"lifecycle_state": "ACTIVE",
14+
"parent_path": "/Workspace/Users/[USERNAME]",
15+
"path": "/Users/[USERNAME]/test bundle-deploy-dashboard-dataset [UUID].lvdash.json",
16+
"serialized_dashboard": "{\"pages\":[{\"displayName\":\"Test Page\",\"name\":\"test_page\",\"pageType\":\"PAGE_TYPE_CANVAS\"}]}\n",
17+
"update_time": "[TIMESTAMP]",
18+
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
19+
},
20+
"changes": {
21+
"local": {
22+
"etag": {
23+
"action": "skip",
24+
"old": [ETAG]
25+
}
26+
},
27+
"remote": {
28+
"dataset_catalog": {
29+
"action": "skip",
30+
"old": "main"
31+
},
32+
"dataset_schema": {
33+
"action": "skip",
34+
"old": "default"
35+
},
36+
"serialized_dashboard": {
37+
"action": "skip",
38+
"old": "{\"pages\":[{\"name\":\"test_page\",\"displayName\":\"Test Page\"}]}\n",
39+
"new": "{\"pages\":[{\"displayName\":\"Test Page\",\"name\":\"test_page\",\"pageType\":\"PAGE_TYPE_CANVAS\"}]}\n"
40+
}
41+
}
42+
}
743
}
8-
]
44+
}
945
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"plan_version": 1,
3+
"cli_version": "[DEV_VERSION]",
4+
"plan": {
5+
"resources.dashboards.dashboard1": {
6+
"action": "skip"
7+
}
8+
}
9+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"method": "POST",
3+
"path": "/api/2.0/lakeview/dashboards",
4+
"q": {
5+
"dataset_catalog": "main",
6+
"dataset_schema": "default"
7+
},
8+
"body": {
9+
"display_name": "test bundle-deploy-dashboard-dataset [UUID]",
10+
"parent_path": "/Workspace/Users/[USERNAME]",
11+
"serialized_dashboard": "{\"pages\":[{\"name\":\"test_page\",\"displayName\":\"Test Page\"}]}\n",
12+
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"method": "POST",
3+
"path": "/api/2.0/lakeview/dashboards",
4+
"q": {
5+
"dataset_catalog": "main",
6+
"dataset_schema": "default"
7+
},
8+
"body": {
9+
"display_name": "test bundle-deploy-dashboard-dataset [UUID]",
10+
"parent_path": "/Workspace/Users/[USERNAME]",
11+
"serialized_dashboard": "{\"pages\":[{\"name\":\"test_page\",\"displayName\":\"Test Page\"}]}\n",
12+
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
13+
}
14+
}

acceptance/bundle/resources/dashboards/dataset-catalog-schema/out.post.requests.txt

Lines changed: 0 additions & 14 deletions
This file was deleted.

acceptance/bundle/resources/dashboards/dataset-catalog-schema/out.test.toml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

acceptance/bundle/resources/dashboards/dataset-catalog-schema/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Deployment complete!
1010
"lifecycle_state": "ACTIVE",
1111
"parent_path": "/Users/[USERNAME]",
1212
"path": "/Users/[USERNAME]/test bundle-deploy-dashboard-dataset [UUID].lvdash.json",
13-
"serialized_dashboard": "{\"pages\":[{\"name\":\"test_page\",\"displayName\":\"Test Page\"}]}\n"
13+
"serialized_dashboard": "{\"pages\":[{\"displayName\":\"Test Page\",\"name\":\"test_page\",\"pageType\":\"PAGE_TYPE_CANVAS\"}]}\n"
1414
}
1515

1616
>>> [CLI] bundle plan -o json

acceptance/bundle/resources/dashboards/dataset-catalog-schema/script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ cat out.requests.txt | \
3131
jq 'select(.method == "POST")' | \
3232
jq 'select(.path | contains("/api/2.0/lakeview/dashboards"))' | \
3333
jq 'select(.path | contains("/published") | not)' \
34-
> out.post.requests.txt
34+
> out.post.requests.$DATABRICKS_BUNDLE_ENGINE.txt

acceptance/bundle/resources/dashboards/dataset-catalog-schema/test.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ Local = true
22
Cloud = true
33
RequiresWarehouse = true
44
RecordRequests = true
5+
EnvVaryOutput = "DATABRICKS_BUNDLE_ENGINE"
56

6-
# TODO: test terraform once commit had been released (https://github.com/databricks/terraform-provider-databricks/pull/5259)
77
[EnvMatrix]
8-
DATABRICKS_BUNDLE_ENGINE = ["direct"]
8+
DATABRICKS_BUNDLE_ENGINE = ["direct", "terraform"]
99

1010
Ignore = [
1111
"databricks.yml",

acceptance/internal/materialized_config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func GenerateMaterializedConfig(config TestConfig) (string, error) {
3232
RequiresUnityCatalog: config.RequiresUnityCatalog,
3333
RequiresCluster: config.RequiresCluster,
3434
RequiresWarehouse: config.RequiresWarehouse,
35+
RecordRequests: config.RecordRequests,
3536
EnvMatrix: config.EnvMatrix,
3637
}
3738

0 commit comments

Comments
 (0)