moto/tests/terraformtests/etc/0008-Patch-RDS-improvements.patch
2023-08-21 20:33:16 +00:00

153 lines
6.0 KiB
Diff

From ef15713b2e04a87966d2ddb8822d703c632c9551 Mon Sep 17 00:00:00 2001
From: Bert Blommers <info@bertblommers.nl>
Date: Sun, 13 Aug 2023 21:48:20 +0000
Subject: [PATCH] Patch: RDS timings
---
internal/service/rds/cluster.go | 16 ++++++++--------
internal/service/rds/consts.go | 2 +-
internal/service/rds/instance.go | 24 ++++++++++++------------
3 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/internal/service/rds/cluster.go b/internal/service/rds/cluster.go
index 5b71483600..e18e024e47 100644
--- a/internal/service/rds/cluster.go
+++ b/internal/service/rds/cluster.go
@@ -34,7 +34,7 @@ import (
const (
clusterScalingConfiguration_DefaultMinCapacity = 1
clusterScalingConfiguration_DefaultMaxCapacity = 16
- clusterTimeoutDelete = 2 * time.Minute
+ clusterTimeoutDelete = 5 * time.Second
)
// @SDKResource("aws_rds_cluster", name="Cluster")
@@ -1365,7 +1365,7 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int
}
}
- _, err := tfresource.RetryWhen(ctx, 5*time.Minute,
+ _, err := tfresource.RetryWhen(ctx, 1*time.Minute,
func() (interface{}, error) {
return conn.ModifyDBClusterWithContext(ctx, input)
},
@@ -1694,8 +1694,8 @@ func waitDBClusterCreated(ctx context.Context, conn *rds.RDS, id string, timeout
Target: []string{ClusterStatusAvailable},
Refresh: statusDBCluster(ctx, conn, id),
Timeout: timeout,
- MinTimeout: 10 * time.Second,
- Delay: 30 * time.Second,
+ MinTimeout: 1 * time.Second,
+ Delay: 3 * time.Second,
}
outputRaw, err := stateConf.WaitForStateContext(ctx)
@@ -1721,8 +1721,8 @@ func waitDBClusterUpdated(ctx context.Context, conn *rds.RDS, id string, timeout
Target: []string{ClusterStatusAvailable},
Refresh: statusDBCluster(ctx, conn, id),
Timeout: timeout,
- MinTimeout: 10 * time.Second,
- Delay: 30 * time.Second,
+ MinTimeout: 1 * time.Second,
+ Delay: 3 * time.Second,
}
outputRaw, err := stateConf.WaitForStateContext(ctx)
@@ -1745,8 +1745,8 @@ func waitDBClusterDeleted(ctx context.Context, conn *rds.RDS, id string, timeout
Target: []string{},
Refresh: statusDBCluster(ctx, conn, id),
Timeout: timeout,
- MinTimeout: 10 * time.Second,
- Delay: 30 * time.Second,
+ MinTimeout: 1 * time.Second,
+ Delay: 3 * time.Second,
}
outputRaw, err := stateConf.WaitForStateContext(ctx)
diff --git a/internal/service/rds/consts.go b/internal/service/rds/consts.go
index 6bc2ab6194..937ba77468 100644
--- a/internal/service/rds/consts.go
+++ b/internal/service/rds/consts.go
@@ -239,7 +239,7 @@ func backupTarget_Values() []string {
}
const (
- propagationTimeout = 2 * time.Minute
+ propagationTimeout = 2 * time.Second
)
const (
diff --git a/internal/service/rds/instance.go b/internal/service/rds/instance.go
index eafddc13b0..86809379d9 100644
--- a/internal/service/rds/instance.go
+++ b/internal/service/rds/instance.go
@@ -77,9 +77,9 @@ func ResourceInstance() *schema.Resource {
},
Timeouts: &schema.ResourceTimeout{
- Create: schema.DefaultTimeout(40 * time.Minute),
- Update: schema.DefaultTimeout(80 * time.Minute),
- Delete: schema.DefaultTimeout(60 * time.Minute),
+ Create: schema.DefaultTimeout(40 * time.Second),
+ Update: schema.DefaultTimeout(80 * time.Second),
+ Delete: schema.DefaultTimeout(60 * time.Second),
},
Schema: map[string]*schema.Schema{
@@ -1917,7 +1917,7 @@ func resourceInstanceUpdate(ctx context.Context, d *schema.ResourceData, meta in
DBInstanceIdentifier: aws.String(sourceARN.Identifier),
SkipFinalSnapshot: true,
}
- _, err = tfresource.RetryWhen(ctx, 5*time.Minute,
+ _, err = tfresource.RetryWhen(ctx, 1*time.Minute,
func() (any, error) {
return conn.DeleteDBInstance(ctx, deleteInput)
},
@@ -2520,8 +2520,8 @@ func statusDBInstanceSDKv2(ctx context.Context, conn *rds_sdkv2.Client, id strin
func waitDBInstanceAvailableSDKv1(ctx context.Context, conn *rds.RDS, id string, timeout time.Duration, optFns ...tfresource.OptionsFunc) (*rds.DBInstance, error) {
options := tfresource.Options{
- PollInterval: 10 * time.Second,
- Delay: 1 * time.Minute,
+ PollInterval: 5 * time.Second,
+ Delay: 3 * time.Second,
ContinuousTargetOccurence: 3,
}
for _, fn := range optFns {
@@ -2563,8 +2563,8 @@ func waitDBInstanceAvailableSDKv1(ctx context.Context, conn *rds.RDS, id string,
func waitDBInstanceAvailableSDKv2(ctx context.Context, conn *rds_sdkv2.Client, id string, timeout time.Duration, optFns ...tfresource.OptionsFunc) (*rds.DBInstance, error) { //nolint:unparam
options := tfresource.Options{
- PollInterval: 10 * time.Second,
- Delay: 1 * time.Minute,
+ PollInterval: 2 * time.Second,
+ Delay: 5 * time.Second,
ContinuousTargetOccurence: 3,
}
for _, fn := range optFns {
@@ -2606,8 +2606,8 @@ func waitDBInstanceAvailableSDKv2(ctx context.Context, conn *rds_sdkv2.Client, i
func waitDBInstanceDeleted(ctx context.Context, conn *rds.RDS, id string, timeout time.Duration, optFns ...tfresource.OptionsFunc) (*rds.DBInstance, error) { //nolint:unparam
options := tfresource.Options{
- PollInterval: 10 * time.Second,
- Delay: 1 * time.Minute,
+ PollInterval: 2 * time.Second,
+ Delay: 5 * time.Second,
ContinuousTargetOccurence: 3,
}
for _, fn := range optFns {
@@ -2694,8 +2694,8 @@ func statusBlueGreenDeployment(ctx context.Context, conn *rds_sdkv2.Client, id s
func waitBlueGreenDeploymentAvailable(ctx context.Context, conn *rds_sdkv2.Client, id string, timeout time.Duration, optFns ...tfresource.OptionsFunc) (*types.BlueGreenDeployment, error) {
options := tfresource.Options{
- PollInterval: 10 * time.Second,
- Delay: 1 * time.Minute,
+ PollInterval: 2 * time.Second,
+ Delay: 5 * time.Second,
}
for _, fn := range optFns {
fn(&options)
--
2.25.1