Skip to content

Commit 7e15b9d

Browse files
dependabot[bot]yfodilremyleone
authored
chore(deps): bump github.com/hashicorp/terraform-plugin-testing from 1.5.1 to 1.13.3 (#3304)
* chore(deps): bump github.com/hashicorp/terraform-plugin-testing Bumps [github.com/hashicorp/terraform-plugin-testing](https://github.com/hashicorp/terraform-plugin-testing) from 1.5.1 to 1.13.3. - [Release notes](https://github.com/hashicorp/terraform-plugin-testing/releases) - [Changelog](https://github.com/hashicorp/terraform-plugin-testing/blob/v1.13.3/CHANGELOG.md) - [Commits](hashicorp/terraform-plugin-testing@v1.5.1...v1.13.3) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-plugin-testing dependency-version: 1.13.3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * test(vpc): harden destroy checks with RetryContext * test(ipam): harden destroy checks with RetryContext * test(vpcgw): harden destroy checks with RetryContext * lint * test(fip): harden destroy checks with RetryContext + update cassettes * test(lb): harden destroy checks with RetryContext * test(account): harden destroy checks with RetryContext * test(iam): harden destroy checks with RetryContext * test(iot): harden destroy checks with RetryContext * test(webhosting): harden destroy checks with RetryContext * test(inference): harden destroy checks with RetryContext * test(cockpit): harden destroy checks with RetryContext * test(registry): harden destroy checks with RetryContext * test(redis): harden destroy checks with RetryContext * test(k8s): harden destroy checks with RetryContext * test(baremetal): harden destroy checks with RetryContext * test(mongodb): harden destroy checks with RetryContext * test(secret): harden destroy checks with RetryContext * test(rdb): harden destroy checks with RetryContext * lint * test(instance): harden destroy checks with RetryContext * fix * fix * replace hardcoded timeouts with DestroyWaitTimeout * fix --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yacine FODIL <[email protected]> Co-authored-by: Yacine Fodil <[email protected]> Co-authored-by: Rémy Léone <[email protected]>
1 parent 3a539a6 commit 7e15b9d

File tree

81 files changed

+41708
-39093
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+41708
-39093
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require (
2525
github.com/hashicorp/terraform-plugin-log v0.9.0
2626
github.com/hashicorp/terraform-plugin-mux v0.20.0
2727
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0
28-
github.com/hashicorp/terraform-plugin-testing v1.5.1
28+
github.com/hashicorp/terraform-plugin-testing v1.13.3
2929
github.com/nats-io/jwt/v2 v2.8.0
3030
github.com/nats-io/nats.go v1.45.0
3131
github.com/robfig/cron/v3 v3.0.1
@@ -149,7 +149,7 @@ require (
149149
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
150150
github.com/yuin/goldmark v1.7.7 // indirect
151151
github.com/yuin/goldmark-meta v1.1.0 // indirect
152-
github.com/zclconf/go-cty v1.16.2 // indirect
152+
github.com/zclconf/go-cty v1.16.3 // indirect
153153
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
154154
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
155155
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ github.com/hashicorp/terraform-plugin-mux v0.20.0 h1:3QpBnI9uCuL0Yy2Rq/kR9cOdmOF
332332
github.com/hashicorp/terraform-plugin-mux v0.20.0/go.mod h1:wSIZwJjSYk86NOTX3fKUlThMT4EAV1XpBHz9SAvjQr4=
333333
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0 h1:NFPMacTrY/IdcIcnUB+7hsore1ZaRWU9cnB6jFoBnIM=
334334
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0/go.mod h1:QYmYnLfsosrxjCnGY1p9c7Zj6n9thnEE+7RObeYs3fA=
335-
github.com/hashicorp/terraform-plugin-testing v1.5.1 h1:T4aQh9JAhmWo4+t1A7x+rnxAJHCDIYW9kXyo4sVO92c=
336-
github.com/hashicorp/terraform-plugin-testing v1.5.1/go.mod h1:dg8clO6K59rZ8w9EshBmDp1CxTIPu3yA4iaDpX1h5u0=
335+
github.com/hashicorp/terraform-plugin-testing v1.13.3 h1:QLi/khB8Z0a5L54AfPrHukFpnwsGL8cwwswj4RZduCo=
336+
github.com/hashicorp/terraform-plugin-testing v1.13.3/go.mod h1:WHQ9FDdiLoneey2/QHpGM/6SAYf4A7AZazVg7230pLE=
337337
github.com/hashicorp/terraform-registry-address v0.2.5 h1:2GTftHqmUhVOeuu9CW3kwDkRe4pcBDq0uuK5VJngU1M=
338338
github.com/hashicorp/terraform-registry-address v0.2.5/go.mod h1:PpzXWINwB5kuVS5CA7m1+eO2f1jKb5ZDIxrOPfpnGkg=
339339
github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ=
@@ -512,8 +512,8 @@ github.com/yuin/goldmark v1.7.7 h1:5m9rrB1sW3JUMToKFQfb+FGt1U7r57IHu5GrYrG2nqU=
512512
github.com/yuin/goldmark v1.7.7/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
513513
github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc=
514514
github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0=
515-
github.com/zclconf/go-cty v1.16.2 h1:LAJSwc3v81IRBZyUVQDUdZ7hs3SYs9jv0eZJDWHD/70=
516-
github.com/zclconf/go-cty v1.16.2/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
515+
github.com/zclconf/go-cty v1.16.3 h1:osr++gw2T61A8KVYHoQiFbFd1Lh3JOCXc/jFLJXKTxk=
516+
github.com/zclconf/go-cty v1.16.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
517517
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo=
518518
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM=
519519
go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw=

internal/services/account/project_test.go

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package account_test
22

33
import (
4+
"context"
45
"fmt"
56
"testing"
7+
"time"
68

9+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
710
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
811
"github.com/hashicorp/terraform-plugin-testing/terraform"
912
accountSDK "github.com/scaleway/scaleway-sdk-go/api/account/v3"
@@ -12,6 +15,8 @@ import (
1215
"github.com/scaleway/terraform-provider-scaleway/v2/internal/services/account"
1316
)
1417

18+
var DestroyWaitTimeout = 3 * time.Minute
19+
1520
func TestAccProject_Basic(t *testing.T) {
1621
tt := acctest.NewTestTools(t)
1722
defer tt.Cleanup()
@@ -101,29 +106,31 @@ func isProjectPresent(tt *acctest.TestTools, name string) resource.TestCheckFunc
101106
}
102107

103108
func isProjectDestroyed(tt *acctest.TestTools) resource.TestCheckFunc {
104-
return func(s *terraform.State) error {
105-
for _, rs := range s.RootModule().Resources {
106-
if rs.Type != "scaleway_account_project" {
107-
continue
108-
}
109-
110-
accountAPI := account.NewProjectAPI(tt.Meta)
109+
return func(state *terraform.State) error {
110+
ctx := context.Background()
111+
api := account.NewProjectAPI(tt.Meta)
111112

112-
_, err := accountAPI.GetProject(&accountSDK.ProjectAPIGetProjectRequest{
113-
ProjectID: rs.Primary.ID,
114-
})
113+
return retry.RetryContext(ctx, DestroyWaitTimeout, func() *retry.RetryError {
114+
for _, rs := range state.RootModule().Resources {
115+
if rs.Type != "scaleway_account_project" {
116+
continue
117+
}
115118

116-
// If no error resource still exist
117-
if err == nil {
118-
return fmt.Errorf("resource %s(%s) still exist", rs.Type, rs.Primary.ID)
119-
}
119+
_, err := api.GetProject(&accountSDK.ProjectAPIGetProjectRequest{
120+
ProjectID: rs.Primary.ID,
121+
})
120122

121-
// Unexpected api error we return it
122-
if !httperrors.Is404(err) {
123-
return err
123+
switch {
124+
case err == nil:
125+
return retry.RetryableError(fmt.Errorf("resource %s(%s) still exists", rs.Type, rs.Primary.ID))
126+
case httperrors.Is404(err):
127+
continue
128+
default:
129+
return retry.NonRetryableError(err)
130+
}
124131
}
125-
}
126132

127-
return nil
133+
return nil
134+
})
128135
}
129136
}

0 commit comments

Comments
 (0)