From 4d84f84ffcc7c9e6e1ac19badbe7d5251f4bc793 Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Tue, 28 Jun 2022 14:39:50 +0000 Subject: [PATCH] TF - improve wait times EC2/Route53 (#5274) --- tests/terraformtests/bin/run_go_test | 1 + .../etc/0002-EC2-reduce-wait-times.patch | 36 ++++----- .../etc/0005-Route53-Reduce-wait-times.patch | 77 +++++++++++++++++++ 3 files changed, 96 insertions(+), 18 deletions(-) create mode 100644 tests/terraformtests/etc/0005-Route53-Reduce-wait-times.patch diff --git a/tests/terraformtests/bin/run_go_test b/tests/terraformtests/bin/run_go_test index 3a6c7a30d..5b1e3b889 100755 --- a/tests/terraformtests/bin/run_go_test +++ b/tests/terraformtests/bin/run_go_test @@ -10,6 +10,7 @@ PATCH="etc/0001-Patch-Hardcode-endpoints-to-local-server.patch" (git apply $pwd/etc/0002-EC2-reduce-wait-times.patch > /dev/null 2>&1 && echo "Patched EC2") || echo "Not patching EC2 - Directory was probably already patched." (git apply $pwd/etc/0003-Patch-IAM-wait-times.patch > /dev/null 2>&1 && echo "Patched IAM") || echo "Not patching IAM - Directory was probably already patched." (git apply $pwd/etc/0004-DAX-Reduce-wait-times.patch > /dev/null 2>&1 && echo "Patched DAX") || echo "Not patching DAX - Directory was probably already patched." +(git apply $pwd/etc/0005-Route53-Reduce-wait-times.patch > /dev/null 2>&1 && echo "Patched Route53") || echo "Not patching Route53 - Directory was probably already patched." ) ( diff --git a/tests/terraformtests/etc/0002-EC2-reduce-wait-times.patch b/tests/terraformtests/etc/0002-EC2-reduce-wait-times.patch index 49435d728..b7935e0ea 100644 --- a/tests/terraformtests/etc/0002-EC2-reduce-wait-times.patch +++ b/tests/terraformtests/etc/0002-EC2-reduce-wait-times.patch @@ -552,8 +552,8 @@ index 01e170d231..10bc05b4b6 100644 Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(2 * time.Minute), - Update: schema.DefaultTimeout(2 * time.Minute), -+ Create: schema.DefaultTimeout(2 * time.Second), -+ Update: schema.DefaultTimeout(2 * time.Second), ++ Create: schema.DefaultTimeout(20 * time.Second), ++ Update: schema.DefaultTimeout(20 * time.Second), }, // @@ -567,7 +567,7 @@ index 9a0a8151e2..8bcd1eb537 100644 Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(10 * time.Minute), - Delete: schema.DefaultTimeout(20 * time.Minute), -+ Create: schema.DefaultTimeout(10 * time.Second), ++ Create: schema.DefaultTimeout(20 * time.Second), + Delete: schema.DefaultTimeout(20 * time.Second), }, @@ -581,7 +581,7 @@ index bc03d302e0..76ae4c7554 100644 const ( // Maximum amount of time to wait for VPC Endpoint creation - VPCEndpointCreationTimeout = 10 * time.Minute -+ VPCEndpointCreationTimeout = 10 * time.Second ++ VPCEndpointCreationTimeout = 20 * time.Second ) func ResourceVPCEndpoint() *schema.Resource { @@ -591,8 +591,8 @@ index bc03d302e0..76ae4c7554 100644 Create: schema.DefaultTimeout(VPCEndpointCreationTimeout), - Update: schema.DefaultTimeout(10 * time.Minute), - Delete: schema.DefaultTimeout(10 * time.Minute), -+ Update: schema.DefaultTimeout(10 * time.Second), -+ Delete: schema.DefaultTimeout(10 * time.Second), ++ Update: schema.DefaultTimeout(20 * time.Second), ++ Delete: schema.DefaultTimeout(20 * time.Second), }, CustomizeDiff: verify.SetTagsDiff, @@ -606,8 +606,8 @@ index 98ba994861..f653423ae1 100644 Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(10 * time.Minute), - Delete: schema.DefaultTimeout(10 * time.Minute), -+ Create: schema.DefaultTimeout(10 * time.Second), -+ Delete: schema.DefaultTimeout(10 * time.Second), ++ Create: schema.DefaultTimeout(20 * time.Second), ++ Delete: schema.DefaultTimeout(20 * time.Second), }, } } @@ -620,7 +620,7 @@ index 5e38bebaca..cf4e397598 100644 Target: []string{ec2.ServiceStateAvailable}, Refresh: vpcEndpointServiceStateRefresh(conn, d.Id()), - Timeout: 10 * time.Minute, -+ Timeout: 10 * time.Second, ++ Timeout: 20 * time.Second, Delay: 5 * time.Second, MinTimeout: 5 * time.Second, } @@ -629,7 +629,7 @@ index 5e38bebaca..cf4e397598 100644 Target: []string{ec2.ServiceStateDeleted}, Refresh: vpcEndpointServiceStateRefresh(conn, serviceID), - Timeout: 10 * time.Minute, -+ Timeout: 10 * time.Second, ++ Timeout: 20 * time.Second, Delay: 5 * time.Second, MinTimeout: 5 * time.Second, } @@ -655,7 +655,7 @@ index 793eea6ef2..b9b5b062d1 100644 - Delay: 1 * time.Minute, - Timeout: 3 * time.Minute, + Delay: 1 * time.Second, -+ Timeout: 3 * time.Second, ++ Timeout: 10 * time.Second, Target: []string{"ok"}, Refresh: func() (interface{}, string, error) { output, err := conn.ModifyVpcEndpoint(input) @@ -700,9 +700,9 @@ index 7ed8ec448c..d74eef1bc9 100644 - Create: schema.DefaultTimeout(1 * time.Minute), - Update: schema.DefaultTimeout(1 * time.Minute), - Delete: schema.DefaultTimeout(1 * time.Minute), -+ Create: schema.DefaultTimeout(1 * time.Second), -+ Update: schema.DefaultTimeout(1 * time.Second), -+ Delete: schema.DefaultTimeout(1 * time.Second), ++ Create: schema.DefaultTimeout(10 * time.Second), ++ Update: schema.DefaultTimeout(10 * time.Second), ++ Delete: schema.DefaultTimeout(10 * time.Second), }, // Keep in sync with aws_vpc_peering_connection_accepter's schema. @@ -716,8 +716,8 @@ index 5fb1bcb194..2b00ab82d0 100644 Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(1 * time.Minute), - Update: schema.DefaultTimeout(1 * time.Minute), -+ Create: schema.DefaultTimeout(1 * time.Second), -+ Update: schema.DefaultTimeout(1 * time.Second), ++ Create: schema.DefaultTimeout(10 * time.Second), ++ Update: schema.DefaultTimeout(10 * time.Second), }, Importer: &schema.ResourceImporter{ @@ -733,7 +733,7 @@ index b81c585ac3..5b5eebd83b 100644 - Update: schema.DefaultTimeout(2 * time.Minute), - Delete: schema.DefaultTimeout(5 * time.Minute), + Create: schema.DefaultTimeout(5 * time.Second), -+ Update: schema.DefaultTimeout(2 * time.Second), ++ Update: schema.DefaultTimeout(5 * time.Second), + Delete: schema.DefaultTimeout(5 * time.Second), }, @@ -750,7 +750,7 @@ index 5a7b5d36ac..e228b3da4a 100644 - Update: schema.DefaultTimeout(2 * time.Minute), - Delete: schema.DefaultTimeout(5 * time.Minute), + Create: schema.DefaultTimeout(5 * time.Second), -+ Update: schema.DefaultTimeout(2 * time.Second), ++ Update: schema.DefaultTimeout(5 * time.Second), + Delete: schema.DefaultTimeout(5 * time.Second), }, diff --git a/tests/terraformtests/etc/0005-Route53-Reduce-wait-times.patch b/tests/terraformtests/etc/0005-Route53-Reduce-wait-times.patch new file mode 100644 index 000000000..821f05127 --- /dev/null +++ b/tests/terraformtests/etc/0005-Route53-Reduce-wait-times.patch @@ -0,0 +1,77 @@ +From 455475a4dbd9143605320fbcab748a569efecbcd Mon Sep 17 00:00:00 2001 +From: Bert Blommers +Date: Tue, 28 Jun 2022 11:17:35 +0000 +Subject: [PATCH] Route53 - wait times + +--- + internal/service/route53/record.go | 4 ++-- + internal/service/route53/wait.go | 6 +++--- + internal/service/route53/zone.go | 2 +- + internal/service/route53/zone_association.go | 2 +- + 4 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/internal/service/route53/record.go b/internal/service/route53/record.go +index 689d21387b..771d863a31 100644 +--- a/internal/service/route53/record.go ++++ b/internal/service/route53/record.go +@@ -490,8 +490,8 @@ func WaitForRecordSetToSync(conn *route53.Route53, requestId string) error { + 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: 5 * 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 c47a81ef03..98c21e6b8e 100644 +--- a/internal/service/route53/wait.go ++++ b/internal/service/route53/wait.go +@@ -13,13 +13,13 @@ import ( + ) + + const ( +- changeTimeout = 30 * time.Minute ++ changeTimeout = 3 * time.Minute + changeMinTimeout = 5 * time.Second +- changePollInterval = 15 * time.Second ++ changePollInterval = 5 * time.Second + changeMinDelay = 10 + changeMaxDelay = 30 + +- hostedZoneDNSSECStatusTimeout = 5 * time.Minute ++ hostedZoneDNSSECStatusTimeout = 1 * time.Minute + + keySigningKeyStatusTimeout = 5 * time.Minute + +diff --git a/internal/service/route53/zone.go b/internal/service/route53/zone.go +index d91b13f953..eed86ef027 100644 +--- a/internal/service/route53/zone.go ++++ b/internal/service/route53/zone.go +@@ -698,7 +698,7 @@ func waitForChangeSynchronization(conn *route53.Route53, changeID string) error + Delay: time.Duration(rand.Int63n(zoneChangeSyncMaxDelay-zoneChangeSyncMinDelay)+zoneChangeSyncMinDelay) * time.Second, + MinTimeout: 5 * 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), +diff --git a/internal/service/route53/zone_association.go b/internal/service/route53/zone_association.go +index c11188caa9..0103797de7 100644 +--- a/internal/service/route53/zone_association.go ++++ b/internal/service/route53/zone_association.go +@@ -84,7 +84,7 @@ func resourceZoneAssociationCreate(d *schema.ResourceData, meta interface{}) err + Delay: 30 * time.Second, + Pending: []string{route53.ChangeStatusPending}, + Target: []string{route53.ChangeStatusInsync}, +- Timeout: 10 * time.Minute, ++ Timeout: 1 * time.Minute, + MinTimeout: 2 * time.Second, + Refresh: resourceZoneAssociationRefreshFunc(conn, CleanChangeID(aws.StringValue(output.ChangeInfo.Id)), d.Id()), + } +-- +2.25.1 +