moto/tests/terraformtests/etc/0005-Route53-Reduce-wait-times.patch
2023-08-21 20:33:16 +00:00

146 lines
5.8 KiB
Diff

From 094b3837cd19df89d266038a91592126723cf833 Mon Sep 17 00:00:00 2001
From: Bert Blommers <info@bertblommers.nl>
Date: Sun, 13 Aug 2023 21:40:43 +0000
Subject: [PATCH] Patch: Route53 timings
---
internal/service/route53/record.go | 10 +++++-----
internal/service/route53/wait.go | 14 +++++++-------
internal/service/route53/zone.go | 20 ++++++++++----------
3 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/internal/service/route53/record.go b/internal/service/route53/record.go
index 4f2eb6d5ef..c4ba38824f 100644
--- a/internal/service/route53/record.go
+++ b/internal/service/route53/record.go
@@ -25,8 +25,8 @@ import (
)
const (
- recordSetSyncMinDelay = 10
- recordSetSyncMaxDelay = 30
+ recordSetSyncMinDelay = 1
+ recordSetSyncMaxDelay = 3
)
// @SDKResource("aws_route53_record")
@@ -749,7 +749,7 @@ func FindResourceRecordSetByFourPartKey(ctx context.Context, conn *route53.Route
}
func ChangeResourceRecordSets(ctx context.Context, conn *route53.Route53, input *route53.ChangeResourceRecordSetsInput) (*route53.ChangeInfo, error) {
- outputRaw, err := tfresource.RetryWhenAWSErrCodeEquals(ctx, 1*time.Minute, func() (interface{}, error) {
+ outputRaw, err := tfresource.RetryWhenAWSErrCodeEquals(ctx, 10*time.Second, func() (interface{}, error) {
return conn.ChangeResourceRecordSetsWithContext(ctx, input)
}, route53.ErrCodeNoSuchHostedZone)
@@ -766,8 +766,8 @@ func WaitForRecordSetToSync(ctx context.Context, conn *route53.Route53, requestI
Target: []string{route53.ChangeStatusInsync},
Delay: time.Duration(rand.Int63n(recordSetSyncMaxDelay-recordSetSyncMinDelay)+recordSetSyncMinDelay) * time.Second,
MinTimeout: 5 * time.Second,
- PollInterval: 20 * time.Second,
- Timeout: 30 * time.Minute,
+ PollInterval: 2 * time.Second,
+ Timeout: 3 * time.Minute,
Refresh: func() (result interface{}, state string, err error) {
changeRequest := &route53.GetChangeInput{
Id: aws.String(requestId),
diff --git a/internal/service/route53/wait.go b/internal/service/route53/wait.go
index d8f577b269..2fc26bf570 100644
--- a/internal/service/route53/wait.go
+++ b/internal/service/route53/wait.go
@@ -16,17 +16,17 @@ import (
)
const (
- changeTimeout = 30 * time.Minute
+ changeTimeout = 3 * time.Minute
changeMinTimeout = 5 * time.Second
- changePollInterval = 15 * time.Second
- changeMinDelay = 10
- changeMaxDelay = 30
+ changePollInterval = 1 * time.Second
+ changeMinDelay = 1
+ changeMaxDelay = 3
- hostedZoneDNSSECStatusTimeout = 5 * time.Minute
+ hostedZoneDNSSECStatusTimeout = 1 * time.Minute
- keySigningKeyStatusTimeout = 5 * time.Minute
+ keySigningKeyStatusTimeout = 1 * time.Minute
- trafficPolicyInstanceOperationTimeout = 4 * time.Minute
+ trafficPolicyInstanceOperationTimeout = 1 * time.Minute
)
func waitChangeInfoStatusInsync(ctx context.Context, conn *route53.Route53, changeID string) (*route53.ChangeInfo, error) { //nolint:unparam
diff --git a/internal/service/route53/zone.go b/internal/service/route53/zone.go
index dc080c4916..493d5a41aa 100644
--- a/internal/service/route53/zone.go
+++ b/internal/service/route53/zone.go
@@ -32,10 +32,10 @@ import (
)
const (
- zoneChangeSyncMinDelay = 10
- zoneChangeSyncMaxDelay = 30
- zoneChangeSyncMinPollInterval = 15
- zoneChangeSyncMaxPollInterval = 30
+ zoneChangeSyncMinDelay = 1
+ zoneChangeSyncMaxDelay = 3
+ zoneChangeSyncMinPollInterval = 2
+ zoneChangeSyncMaxPollInterval = 3
)
// @SDKResource("aws_route53_zone", name="Hosted Zone")
@@ -424,7 +424,7 @@ func dnsSECStatus(ctx context.Context, conn *route53.Route53, hostedZoneID strin
}
var output *route53.GetDNSSECOutput
- err := tfresource.Retry(ctx, 3*time.Minute, func() *retry.RetryError {
+ err := tfresource.Retry(ctx, 3*time.Second, func() *retry.RetryError {
var err error
output, err = conn.GetDNSSECWithContext(ctx, input)
@@ -439,7 +439,7 @@ func dnsSECStatus(ctx context.Context, conn *route53.Route53, hostedZoneID strin
}
return nil
- }, tfresource.WithDelayRand(1*time.Minute), tfresource.WithPollInterval(30*time.Second))
+ }, tfresource.WithDelayRand(5*time.Second), tfresource.WithPollInterval(3*time.Second))
if tfresource.TimedOut(err) {
output, err = conn.GetDNSSECWithContext(ctx, input)
@@ -480,7 +480,7 @@ func disableDNSSECForHostedZone(ctx context.Context, conn *route53.Route53, host
}
var output *route53.DisableHostedZoneDNSSECOutput
- err = tfresource.Retry(ctx, 5*time.Minute, func() *retry.RetryError {
+ err = tfresource.Retry(ctx, 5*time.Second, func() *retry.RetryError {
var err error
output, err = conn.DisableHostedZoneDNSSECWithContext(ctx, input)
@@ -495,7 +495,7 @@ func disableDNSSECForHostedZone(ctx context.Context, conn *route53.Route53, host
}
return nil
- }, tfresource.WithDelayRand(1*time.Minute), tfresource.WithPollInterval(20*time.Second))
+ }, tfresource.WithDelayRand(1*time.Second), tfresource.WithPollInterval(20*time.Second))
if tfresource.TimedOut(err) {
output, err = conn.DisableHostedZoneDNSSECWithContext(ctx, input)
@@ -687,9 +687,9 @@ func waitForChangeSynchronization(ctx context.Context, conn *route53.Route53, ch
Pending: []string{route53.ChangeStatusPending},
Target: []string{route53.ChangeStatusInsync},
Delay: time.Duration(rand.Int63n(zoneChangeSyncMaxDelay-zoneChangeSyncMinDelay)+zoneChangeSyncMinDelay) * time.Second,
- MinTimeout: 5 * time.Second,
+ MinTimeout: 1 * time.Second,
PollInterval: time.Duration(rand.Int63n(zoneChangeSyncMaxPollInterval-zoneChangeSyncMinPollInterval)+zoneChangeSyncMinPollInterval) * time.Second,
- Timeout: 15 * time.Minute,
+ Timeout: 1 * time.Minute,
Refresh: func() (result interface{}, state string, err error) {
input := &route53.GetChangeInput{
Id: aws.String(changeID),
--
2.25.1