Skip to content

Commit 0a6a4a8

Browse files
Update postgres cloud test golden outputs (#5905)
## Changes Update postgres endpoint & database golden outputs Dropping unrelated/irrelevant fields from endpoint tests to avoid churn when backend changes ## Why Failing in cloud ## Tests CI
1 parent 7875f5b commit 0a6a4a8

13 files changed

Lines changed: 44 additions & 177 deletions

File tree

acceptance/bundle/resources/postgres_databases/live_errors/missing_role/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/missing-role-[UNIQUE_NAME]/default/files...
22
Deploying resources...
3-
Error: cannot create resources.postgres_databases.my_database: Field 'spec.role' cannot be empty (400 INVALID_PARAMETER_VALUE)
3+
Error: cannot create resources.postgres_databases.my_database: Field 'database.spec.role' is required, expected non-default value (400 INVALID_PARAMETER_VALUE)
44

55
Endpoint: POST [DATABRICKS_URL]/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/databases?database_id=my-database
66
HTTP Status: 400 Bad Request
77
API error_code: INVALID_PARAMETER_VALUE
8-
API message: Field 'spec.role' cannot be empty
8+
API message: Field 'database.spec.role' is required, expected non-default value
99

1010
Updating deployment state...
1111

acceptance/bundle/resources/postgres_databases/live_errors/missing_role/script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ cleanup() {
55
}
66
trap cleanup EXIT
77

8-
musterr $CLI bundle deploy 2>&1 | contains.py "Field 'spec.role' cannot be empty"
8+
musterr $CLI bundle deploy 2>&1 | contains.py "Field 'database.spec.role' is required, expected non-default value"

acceptance/bundle/resources/postgres_endpoints/basic/output.txt

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,14 @@ Deployment complete!
3939
"endpoint_id": "custom",
4040
"name": "projects/test-pg-proj-[UNIQUE_NAME]/branches/main/endpoints/custom",
4141
"parent": "projects/test-pg-proj-[UNIQUE_NAME]/branches/main",
42+
"uid": "[ENDPOINT_UID]",
4243
"status": {
43-
"autoscaling_limit_max_cu": 2,
44-
"autoscaling_limit_min_cu": 0.5,
45-
"current_state": "ACTIVE",
46-
"disabled": false,
4744
"endpoint_id": "custom",
4845
"endpoint_type": "ENDPOINT_TYPE_READ_ONLY",
49-
"group": {
50-
"enable_readable_secondaries": true,
51-
"max": 1,
52-
"min": 1
53-
},
54-
"hosts": {
55-
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com",
56-
"read_only_host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
57-
},
58-
"settings": {},
46+
"autoscaling_limit_min_cu": 0.5,
47+
"autoscaling_limit_max_cu": 2,
5948
"suspend_timeout_duration": "300s"
60-
},
61-
"uid": "[ENDPOINT_UID]"
49+
}
6250
}
6351

6452
>>> [CLI] bundle summary

acceptance/bundle/resources/postgres_endpoints/basic/script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ trace $CLI bundle deploy
1717
project_name="projects/test-pg-proj-${UNIQUE_NAME}"
1818
branch_name="${project_name}/branches/main"
1919
endpoint_name="${branch_name}/endpoints/custom"
20-
trace $CLI postgres get-endpoint "${endpoint_name}" | jq 'del(.create_time, .update_time)'
20+
trace $CLI postgres get-endpoint "${endpoint_name}" | endpoint_fields
2121

2222
trace $CLI bundle summary
2323

acceptance/bundle/resources/postgres_endpoints/replace_existing/output.txt

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,14 @@ Deployment complete!
1919
"endpoint_id": "primary",
2020
"name": "projects/test-pg-proj-[UNIQUE_NAME]/branches/develop/endpoints/primary",
2121
"parent": "projects/test-pg-proj-[UNIQUE_NAME]/branches/develop",
22+
"uid": "[ENDPOINT_UID]",
2223
"status": {
23-
"autoscaling_limit_max_cu": 4,
24-
"autoscaling_limit_min_cu": 0.5,
25-
"current_state": "ACTIVE",
26-
"disabled": false,
2724
"endpoint_id": "primary",
2825
"endpoint_type": "ENDPOINT_TYPE_READ_WRITE",
29-
"group": {
30-
"enable_readable_secondaries": false,
31-
"max": 1,
32-
"min": 1
33-
},
34-
"hosts": {
35-
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
36-
},
37-
"settings": {},
26+
"autoscaling_limit_min_cu": 0.5,
27+
"autoscaling_limit_max_cu": 4,
3828
"suspend_timeout_duration": "600s"
39-
},
40-
"uid": "[ENDPOINT_UID]"
29+
}
4130
}
4231

4332
>>> print_requests.py --del-body project_id,branch_id,endpoint_id,database_id,role_id,catalog_id,synced_table_id --keep --get //postgres ^//workspace-files/ ^//workspace/ ^//telemetry-ext ^//operations/

acceptance/bundle/resources/postgres_endpoints/replace_existing/script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ trace $CLI bundle deploy
1515
# The implicit primary endpoint inherits suspend_timeout_duration from the
1616
# project default (300s). After deploy with replace_existing=true, the
1717
# bundle's spec must be applied: 600s.
18-
trace $CLI postgres get-endpoint "projects/test-pg-proj-${UNIQUE_NAME}/branches/develop/endpoints/primary" | jq 'del(.create_time, .update_time)'
18+
trace $CLI postgres get-endpoint "projects/test-pg-proj-${UNIQUE_NAME}/branches/develop/endpoints/primary" | endpoint_fields
1919

2020
trace print_requests.py --del-body project_id,branch_id,endpoint_id,database_id,role_id,catalog_id,synced_table_id --keep --get '//postgres' '^//workspace-files/' '^//workspace/' '^//telemetry-ext' '^//operations/' > out.requests.deploy.$DATABRICKS_BUNDLE_ENGINE.json
2121

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# endpoint_fields projects a `postgres get-endpoint` response (stdin) down to the
2+
# identifying fields plus the status fields the bundle spec controls. Server-
3+
# materialized status fields (hosts, current_state, group, settings,
4+
# last_active_time, ...) are deliberately dropped: they differ between the
5+
# testserver mock and the real backend, and the backend keeps adding new ones
6+
# over time. Asserting only these stable fields keeps local and cloud output
7+
# identical without chasing every backend field.
8+
endpoint_fields() {
9+
jq '{endpoint_id, name, parent, uid, status: (.status | {endpoint_id, endpoint_type, autoscaling_limit_min_cu, autoscaling_limit_max_cu, suspend_timeout_duration})}'
10+
}

acceptance/bundle/resources/postgres_endpoints/update_autoscaling/out.plan.no_change.direct.json

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,6 @@
66
}
77
],
88
"action": "skip",
9-
"remote_state": {
10-
"create_time": "[TIMESTAMP]",
11-
"endpoint_id": "my-endpoint",
12-
"endpoint_type": "",
13-
"name": "[MY_ENDPOINT_ID]",
14-
"parent": "projects/test-pg-proj-[UNIQUE_NAME]/branches/main",
15-
"status": {
16-
"autoscaling_limit_max_cu": 8,
17-
"autoscaling_limit_min_cu": 0.5,
18-
"current_state": "ACTIVE",
19-
"disabled": false,
20-
"endpoint_id": "my-endpoint",
21-
"endpoint_type": "ENDPOINT_TYPE_READ_ONLY",
22-
"group": {
23-
"enable_readable_secondaries": true,
24-
"max": 1,
25-
"min": 1
26-
},
27-
"hosts": {
28-
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com",
29-
"read_only_host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
30-
},
31-
"settings": {},
32-
"suspend_timeout_duration": "300s"
33-
},
34-
"uid": "[ENDPOINT_UID]",
35-
"update_time": "[TIMESTAMP]"
36-
},
379
"changes": {
3810
"autoscaling_limit_max_cu": {
3911
"action": "skip",

acceptance/bundle/resources/postgres_endpoints/update_autoscaling/out.plan.restore.direct.json

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,6 @@
1616
"suspend_timeout_duration": "300s"
1717
}
1818
},
19-
"remote_state": {
20-
"create_time": "[TIMESTAMP]",
21-
"endpoint_id": "my-endpoint",
22-
"endpoint_type": "",
23-
"name": "[MY_ENDPOINT_ID]",
24-
"parent": "projects/test-pg-proj-[UNIQUE_NAME]/branches/main",
25-
"status": {
26-
"autoscaling_limit_max_cu": 4,
27-
"autoscaling_limit_min_cu": 0.5,
28-
"current_state": "ACTIVE",
29-
"disabled": false,
30-
"endpoint_id": "my-endpoint",
31-
"endpoint_type": "ENDPOINT_TYPE_READ_ONLY",
32-
"group": {
33-
"enable_readable_secondaries": true,
34-
"max": 1,
35-
"min": 1
36-
},
37-
"hosts": {
38-
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com",
39-
"read_only_host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
40-
},
41-
"settings": {},
42-
"suspend_timeout_duration": "300s"
43-
},
44-
"uid": "[ENDPOINT_UID]",
45-
"update_time": "[TIMESTAMP]"
46-
},
4719
"changes": {
4820
"autoscaling_limit_max_cu": {
4921
"action": "update",

acceptance/bundle/resources/postgres_endpoints/update_autoscaling/out.plan.update.direct.json

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,6 @@
1616
"suspend_timeout_duration": "300s"
1717
}
1818
},
19-
"remote_state": {
20-
"create_time": "[TIMESTAMP]",
21-
"endpoint_id": "my-endpoint",
22-
"endpoint_type": "",
23-
"name": "[MY_ENDPOINT_ID]",
24-
"parent": "projects/test-pg-proj-[UNIQUE_NAME]/branches/main",
25-
"status": {
26-
"autoscaling_limit_max_cu": 8,
27-
"autoscaling_limit_min_cu": 0.5,
28-
"current_state": "ACTIVE",
29-
"disabled": false,
30-
"endpoint_id": "my-endpoint",
31-
"endpoint_type": "ENDPOINT_TYPE_READ_ONLY",
32-
"group": {
33-
"enable_readable_secondaries": true,
34-
"max": 1,
35-
"min": 1
36-
},
37-
"hosts": {
38-
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com",
39-
"read_only_host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
40-
},
41-
"settings": {},
42-
"suspend_timeout_duration": "300s"
43-
},
44-
"uid": "[ENDPOINT_UID]",
45-
"update_time": "[TIMESTAMP]"
46-
},
4719
"changes": {
4820
"autoscaling_limit_max_cu": {
4921
"action": "update",

0 commit comments

Comments
 (0)