Skip to content

Commit c775275

Browse files
authored
Merge pull request #3457 from josh-ferrell/e2e_allocateaddress_fix
Add timeout to AllocateAddress
2 parents 0e86ec7 + d026df2 commit c775275

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
@@ -165,9 +165,14 @@ func (i *AWSInfrastructure) AllocateAddress() AWSInfrastructure {
165165
return *i
166166
}
167167

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

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

0 commit comments

Comments
 (0)