Skip to content

Commit d026df2

Browse files
author
Josh Ferrell
committed
Add timeout to AllocateAddress
Change timeout on AllocateAddress Add validation prior to CreateNatGateway Increment timeout
1 parent 6494d84 commit d026df2

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

test/e2e/shared/aws.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,14 @@ func (i *AWSInfrastructure) AllocateAddress() AWSInfrastructure {
164164
return *i
165165
}
166166

167-
if addr, _ := GetAddress(i.Context, *aa.AllocationId); addr != nil {
168-
i.ElasticIP = addr
167+
t := 0
168+
addr, _ := GetAddress(i.Context, *aa.AllocationId)
169+
for addr == nil || t < 180 {
170+
time.Sleep(1 * time.Second)
171+
addr, _ = GetAddress(i.Context, *aa.AllocationId)
172+
t++
169173
}
174+
i.ElasticIP = addr
170175
return *i
171176
}
172177

@@ -235,9 +240,11 @@ func (i *AWSInfrastructure) CreateInfrastructure() AWSInfrastructure {
235240
i.CreateInternetGateway()
236241
}
237242
i.AllocateAddress()
238-
i.CreateNatGateway("public")
239-
if i.NatGateway != nil && i.NatGateway.NatGatewayId != nil {
240-
WaitForNatGatewayState(i.Context, *i.NatGateway.NatGatewayId, 180, "available")
243+
if i.ElasticIP != nil && i.ElasticIP.AllocationId != nil {
244+
i.CreateNatGateway("public")
245+
if i.NatGateway != nil && i.NatGateway.NatGatewayId != nil {
246+
WaitForNatGatewayState(i.Context, *i.NatGateway.NatGatewayId, 180, "available")
247+
}
241248
}
242249
if len(i.Subnets) == 2 {
243250
i.CreateRouteTable("public")

0 commit comments

Comments
 (0)