Skip to content

Commit 3214888

Browse files
committed
fix flaky test TestAccImage_ServerWithLocalVolume
1 parent 33edb2c commit 3214888

File tree

2 files changed

+2082
-7564
lines changed

2 files changed

+2082
-7564
lines changed

internal/services/instance/image_test.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ func TestAccImage_ServerWithLocalVolume(t *testing.T) {
458458
{
459459
Config: `
460460
resource "scaleway_instance_server" "server01" {
461+
name = "root-vol0"
461462
image = "ubuntu_focal"
462463
type = "DEV1-S"
463464
root_volume {
@@ -466,6 +467,7 @@ func TestAccImage_ServerWithLocalVolume(t *testing.T) {
466467
}
467468
}
468469
resource "scaleway_instance_server" "server02" {
470+
name = "add-vol1"
469471
image = "ubuntu_focal"
470472
type = "DEV1-S"
471473
root_volume {
@@ -474,10 +476,11 @@ func TestAccImage_ServerWithLocalVolume(t *testing.T) {
474476
}
475477
}
476478
resource "scaleway_instance_server" "server03" {
479+
name = "add-vol2"
477480
image = "ubuntu_focal"
478481
type = "DEV1-S"
479482
root_volume {
480-
size_in_gb = 10
483+
size_in_gb = 20
481484
volume_type = "l_ssd"
482485
}
483486
}
@@ -504,6 +507,7 @@ func TestAccImage_ServerWithLocalVolume(t *testing.T) {
504507
{
505508
Config: `
506509
resource "scaleway_instance_server" "server01" {
510+
name = "root-vol0"
507511
image = "ubuntu_focal"
508512
type = "DEV1-S"
509513
root_volume {
@@ -512,6 +516,7 @@ func TestAccImage_ServerWithLocalVolume(t *testing.T) {
512516
}
513517
}
514518
resource "scaleway_instance_server" "server02" {
519+
name = "add-vol1"
515520
image = "ubuntu_focal"
516521
type = "DEV1-S"
517522
root_volume {
@@ -520,10 +525,11 @@ func TestAccImage_ServerWithLocalVolume(t *testing.T) {
520525
}
521526
}
522527
resource "scaleway_instance_server" "server03" {
528+
name = "add-vol2"
523529
image = "ubuntu_focal"
524530
type = "DEV1-S"
525531
root_volume {
526-
size_in_gb = 10
532+
size_in_gb = 20
527533
volume_type = "l_ssd"
528534
}
529535
}
@@ -552,12 +558,12 @@ func TestAccImage_ServerWithLocalVolume(t *testing.T) {
552558
isSnapshotPresent(tt, "scaleway_instance_snapshot.local03"),
553559
instancechecks.DoesImageExists(tt, "scaleway_instance_image.main"),
554560
resource.TestCheckResourceAttrPair("scaleway_instance_image.main", "root_volume_id", "scaleway_instance_snapshot.local01", "id"),
555-
resource.TestCheckResourceAttrPair("scaleway_instance_image.main", "additional_volumes.1.id", "scaleway_instance_snapshot.local02", "id"),
556-
resource.TestCheckResourceAttr("scaleway_instance_image.main", "additional_volumes.1.volume_type", "l_ssd"),
557-
resource.TestCheckResourceAttr("scaleway_instance_image.main", "additional_volumes.1.size", "10000000000"),
558-
resource.TestCheckResourceAttrPair("scaleway_instance_image.main", "additional_volumes.0.id", "scaleway_instance_snapshot.local03", "id"),
559561
resource.TestCheckResourceAttr("scaleway_instance_image.main", "additional_volumes.0.volume_type", "l_ssd"),
560562
resource.TestCheckResourceAttr("scaleway_instance_image.main", "additional_volumes.0.size", "10000000000"),
563+
resource.TestCheckResourceAttrPair("scaleway_instance_image.main", "additional_volumes.0.id", "scaleway_instance_snapshot.local02", "id"),
564+
resource.TestCheckResourceAttr("scaleway_instance_image.main", "additional_volumes.1.volume_type", "l_ssd"),
565+
resource.TestCheckResourceAttr("scaleway_instance_image.main", "additional_volumes.1.size", "20000000000"),
566+
resource.TestCheckResourceAttrPair("scaleway_instance_image.main", "additional_volumes.1.id", "scaleway_instance_snapshot.local03", "id"),
561567
),
562568
},
563569
},

0 commit comments

Comments
 (0)