Skip to content

Commit 3765e56

Browse files
authored
Fix HA Policy update test flakiness (#14960)
1 parent e94584a commit 3765e56

File tree

1 file changed

+44
-30
lines changed

1 file changed

+44
-30
lines changed

mmv1/third_party/terraform/services/compute/resource_compute_region_backend_service_ha_policy_manual_leader_update_test.go

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -128,21 +128,28 @@ resource "google_compute_region_backend_service" "default" {
128128
protocol = "UDP"
129129
load_balancing_scheme = "EXTERNAL"
130130
network = google_compute_network.default.id
131-
backend {
132-
group = google_compute_network_endpoint_group.neg.self_link
133-
balancing_mode = "CONNECTION"
134-
}
135-
ha_policy {
136-
fast_ip_move = "GARP_RA"
137-
leader {
138-
backend_group = google_compute_network_endpoint_group.neg.self_link
139-
network_endpoint {
140-
instance = google_compute_instance.endpoint-instance1.name
141-
}
142-
}
143-
}
144-
// Must explicitly disable connection draining to override default value.
145-
connection_draining_timeout_sec = 0
131+
backend {
132+
group = google_compute_network_endpoint_group.neg.self_link
133+
balancing_mode = "CONNECTION"
134+
}
135+
ha_policy {
136+
fast_ip_move = "GARP_RA"
137+
leader {
138+
backend_group = google_compute_network_endpoint_group.neg.self_link
139+
network_endpoint {
140+
instance = google_compute_instance.endpoint-instance1.name
141+
}
142+
}
143+
}
144+
// Must explicitly disable connection draining to override default value.
145+
connection_draining_timeout_sec = 0
146+
// Explicitly depend on the endpoints to prevent test flakes due to creating
147+
// the BackendService before the endpoints have been added to the NEG.
148+
depends_on = [
149+
google_compute_network_endpoint_group.neg,
150+
google_compute_network_endpoint.endpoint1,
151+
google_compute_network_endpoint.endpoint2
152+
]
146153
}
147154
`, context)
148155
}
@@ -228,21 +235,28 @@ resource "google_compute_region_backend_service" "default" {
228235
protocol = "UDP"
229236
load_balancing_scheme = "EXTERNAL"
230237
network = google_compute_network.default.id
231-
backend {
232-
group = google_compute_network_endpoint_group.neg.self_link
233-
balancing_mode = "CONNECTION"
234-
}
235-
ha_policy {
236-
fast_ip_move = "GARP_RA"
237-
leader {
238-
backend_group = google_compute_network_endpoint_group.neg.self_link
239-
network_endpoint {
240-
instance = google_compute_instance.endpoint-instance2.name
241-
}
242-
}
243-
}
244-
// Must explicitly disable connection draining to override default value.
245-
connection_draining_timeout_sec = 0
238+
backend {
239+
group = google_compute_network_endpoint_group.neg.self_link
240+
balancing_mode = "CONNECTION"
241+
}
242+
ha_policy {
243+
fast_ip_move = "GARP_RA"
244+
leader {
245+
backend_group = google_compute_network_endpoint_group.neg.self_link
246+
network_endpoint {
247+
instance = google_compute_instance.endpoint-instance2.name
248+
}
249+
}
250+
}
251+
// Must explicitly disable connection draining to override default value.
252+
connection_draining_timeout_sec = 0
253+
// Explicitly depend on the endpoints to prevent test flakes due to creating
254+
// the BackendService before the endpoints have been added to the NEG.
255+
depends_on = [
256+
google_compute_network_endpoint_group.neg,
257+
google_compute_network_endpoint.endpoint1,
258+
google_compute_network_endpoint.endpoint2
259+
]
246260
}
247261
`, context)
248262
}

0 commit comments

Comments
 (0)