Skip to content

Commit d8bff37

Browse files
authored
fix(iot): fix route s3 test (#1282)
1 parent 8afb07b commit d8bff37

File tree

2 files changed

+249
-182
lines changed

2 files changed

+249
-182
lines changed

scaleway/resource_iot_routes_test.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"testing"
66

7+
sdkacctest "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
78
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
89
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
910
iot "github.com/scaleway/scaleway-sdk-go/api/iot/v1"
@@ -71,9 +72,12 @@ func TestAccScalewayIotRoute_RDB(t *testing.T) {
7172
}
7273

7374
func TestAccScalewayIotRoute_S3(t *testing.T) {
75+
if !*UpdateCassettes {
76+
t.Skip("Skipping ObjectStorage test as this kind of resource can't be deleted before 24h")
77+
}
7478
tt := NewTestTools(t)
7579
defer tt.Cleanup()
76-
bucketName := "test-acc-scaleway-iot-route-s3"
80+
bucketName := sdkacctest.RandomWithPrefix("test-acc-scaleway-iot-route-s3")
7781

7882
resource.ParallelTest(t, resource.TestCase{
7983
PreCheck: func() { testAccPreCheck(t) },
@@ -87,7 +91,6 @@ func TestAccScalewayIotRoute_S3(t *testing.T) {
8791
{
8892
Config: fmt.Sprintf(`
8993
resource "scaleway_object_bucket" "minimal" {
90-
region = "fr-par"
9194
name = "%s"
9295
}
9396
@@ -107,9 +110,12 @@ func TestAccScalewayIotRoute_S3(t *testing.T) {
107110
object_prefix = "foo"
108111
strategy = "per_topic"
109112
}
113+
114+
depends_on = [scaleway_object_bucket.minimal]
110115
}
111116
`, bucketName),
112117
Check: resource.ComposeTestCheckFunc(
118+
testAccCheckScalewayObjectBucketExists(tt, "scaleway_object_bucket.minimal"),
113119
testAccCheckScalewayIotHubExists(tt, "scaleway_iot_hub.minimal"),
114120
testAccCheckScalewayIotRouteExists(tt, "scaleway_iot_route.default"),
115121
resource.TestCheckResourceAttrSet("scaleway_iot_route.default", "id"),

0 commit comments

Comments
 (0)