Skip to content

Commit cec0797

Browse files
authored
tests(lb): reorder configuration to fix resource dependency timing (#2322)
1 parent f346ab0 commit cec0797

File tree

2 files changed

+2597
-1008
lines changed

2 files changed

+2597
-1008
lines changed

scaleway/resource_lb_backend_test.go

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,60 @@ func TestAccScalewayLbBackend_WithFailoverHost(t *testing.T) {
245245
),
246246
Steps: []resource.TestStep{
247247
{
248-
Config: `
248+
Config: fmt.Sprintf(`
249+
resource "scaleway_object_bucket" "test" {
250+
name = %[1]q
251+
acl = "public-read"
252+
tags = {
253+
TestName = "TestAccSCW_WebsiteConfig_basic"
254+
}
255+
}
256+
257+
resource scaleway_object "some_file" {
258+
bucket = scaleway_object_bucket.test.name
259+
key = "index.html"
260+
file = "testfixture/index.html"
261+
visibility = "public-read"
262+
}
263+
264+
resource "scaleway_object_bucket_website_configuration" "test" {
265+
bucket = scaleway_object_bucket.test.name
266+
index_document {
267+
suffix = "index.html"
268+
}
269+
error_document {
270+
key = "error.html"
271+
}
272+
}
273+
`, rName),
274+
},
275+
{
276+
Config: fmt.Sprintf(`
277+
resource "scaleway_object_bucket" "test" {
278+
name = %[1]q
279+
acl = "public-read"
280+
tags = {
281+
TestName = "TestAccSCW_WebsiteConfig_basic"
282+
}
283+
}
284+
285+
resource scaleway_object "some_file" {
286+
bucket = scaleway_object_bucket.test.name
287+
key = "index.html"
288+
file = "testfixture/index.html"
289+
visibility = "public-read"
290+
}
291+
292+
resource "scaleway_object_bucket_website_configuration" "test" {
293+
bucket = scaleway_object_bucket.test.name
294+
index_document {
295+
suffix = "index.html"
296+
}
297+
error_document {
298+
key = "error.html"
299+
}
300+
}
301+
249302
resource scaleway_lb_ip ip01 {}
250303
resource scaleway_lb lb01 {
251304
ip_id = scaleway_lb_ip.ip01.id
@@ -263,7 +316,7 @@ func TestAccScalewayLbBackend_WithFailoverHost(t *testing.T) {
263316
proxy_protocol = "none"
264317
server_ips = [ scaleway_instance_ip.ip01.address ]
265318
}
266-
`,
319+
`, rName),
267320
Check: testAccCheckScalewayLbBackendExists(tt, "scaleway_lb_backend.bkd01"),
268321
},
269322
{

0 commit comments

Comments
 (0)