Skip to content

Commit a530f2d

Browse files
authored
acc: Fix postgres_endpoints integration tests (#4665)
## Why <!-- Why are these changes needed? Provide the context that the reviewer might be missing. For example, were there any decisions behind the change that are not reflected in the code itself? --> API output has added extra fields. ## Tests <!-- How have you tested the changes? --> Existing tests <!-- If your PR needs to be included in the release notes for next release, add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->
1 parent a71250d commit a530f2d

File tree

6 files changed

+60
-9
lines changed

6 files changed

+60
-9
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,14 @@ Deployment complete!
4444
"current_state": "ACTIVE",
4545
"disabled": false,
4646
"endpoint_type": "ENDPOINT_TYPE_READ_ONLY",
47+
"group": {
48+
"enable_readable_secondaries": true,
49+
"max": 1,
50+
"min": 1
51+
},
4752
"hosts": {
48-
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
53+
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com",
54+
"read_only_host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
4955
},
5056
"settings": {},
5157
"suspend_timeout_duration": "300s"

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,14 @@
1616
"current_state": "ACTIVE",
1717
"disabled": false,
1818
"endpoint_type": "ENDPOINT_TYPE_READ_ONLY",
19+
"group": {
20+
"enable_readable_secondaries": true,
21+
"max": 1,
22+
"min": 1
23+
},
1924
"hosts": {
20-
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
25+
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com",
26+
"read_only_host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
2127
},
2228
"settings": {},
2329
"suspend_timeout_duration": "300s"

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@
2626
"current_state": "ACTIVE",
2727
"disabled": false,
2828
"endpoint_type": "ENDPOINT_TYPE_READ_ONLY",
29+
"group": {
30+
"enable_readable_secondaries": true,
31+
"max": 1,
32+
"min": 1
33+
},
2934
"hosts": {
30-
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
35+
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com",
36+
"read_only_host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
3137
},
3238
"settings": {},
3339
"suspend_timeout_duration": "300s"

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@
2626
"current_state": "ACTIVE",
2727
"disabled": false,
2828
"endpoint_type": "ENDPOINT_TYPE_READ_ONLY",
29+
"group": {
30+
"enable_readable_secondaries": true,
31+
"max": 1,
32+
"min": 1
33+
},
2934
"hosts": {
30-
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
35+
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com",
36+
"read_only_host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
3137
},
3238
"settings": {},
3339
"suspend_timeout_duration": "300s"

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

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,14 @@ Deployment complete!
3636
"current_state": "ACTIVE",
3737
"disabled": false,
3838
"endpoint_type": "ENDPOINT_TYPE_READ_ONLY",
39+
"group": {
40+
"enable_readable_secondaries": true,
41+
"max": 1,
42+
"min": 1
43+
},
3944
"hosts": {
40-
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
45+
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com",
46+
"read_only_host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
4147
},
4248
"settings": {},
4349
"suspend_timeout_duration": "300s"
@@ -117,8 +123,14 @@ Deployment complete!
117123
"current_state": "ACTIVE",
118124
"disabled": false,
119125
"endpoint_type": "ENDPOINT_TYPE_READ_ONLY",
126+
"group": {
127+
"enable_readable_secondaries": true,
128+
"max": 1,
129+
"min": 1
130+
},
120131
"hosts": {
121-
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
132+
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com",
133+
"read_only_host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
122134
},
123135
"settings": {},
124136
"suspend_timeout_duration": "300s"
@@ -154,8 +166,14 @@ Deployment complete!
154166
"current_state": "ACTIVE",
155167
"disabled": false,
156168
"endpoint_type": "ENDPOINT_TYPE_READ_ONLY",
169+
"group": {
170+
"enable_readable_secondaries": true,
171+
"max": 1,
172+
"min": 1
173+
},
157174
"hosts": {
158-
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
175+
"host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com",
176+
"read_only_host": "[ENDPOINT_UID].database.us-east-1.cloud.databricks.com"
159177
},
160178
"settings": {},
161179
"suspend_timeout_duration": "300s"

libs/testserver/postgres.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,18 @@ func (s *FakeWorkspace) PostgresEndpointCreate(req Request, parent, endpointID s
443443
}
444444
}
445445

446-
// Generate a fake host
446+
// Generate fake hosts
447+
host := endpoint.Uid + ".database.us-east-1.cloud.databricks.com"
447448
endpoint.Status.Hosts = &postgres.EndpointHosts{
448-
Host: endpoint.Uid + ".database.us-east-1.cloud.databricks.com",
449+
Host: host,
450+
ReadOnlyHost: host,
451+
}
452+
453+
// Set default group status
454+
endpoint.Status.Group = &postgres.EndpointGroupStatus{
455+
EnableReadableSecondaries: true,
456+
Max: 1,
457+
Min: 1,
449458
}
450459

451460
// Clear spec - API only returns status

0 commit comments

Comments
 (0)