Skip to content

Commit 6afdedd

Browse files
authored
Merge pull request #3418 from josh-ferrell/e2e_extinfra_fix
Move several functions under E2E CreateInfrastructure to panic
2 parents 6ffb722 + 485b7ce commit 6afdedd

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

test/e2e/shared/aws.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,18 +232,28 @@ func (i *AWSInfrastructure) CreateInfrastructure() AWSInfrastructure {
232232
}
233233
time.Sleep(1 * time.Second)
234234
}
235+
i.CreateInternetGateway()
235236
}
236-
i.CreateInternetGateway()
237237
i.AllocateAddress()
238238
i.CreateNatGateway("public")
239-
WaitForNatGatewayState(i.Context, *i.NatGateway.NatGatewayId, 180, "available")
239+
if i.NatGateway != nil && i.NatGateway.NatGatewayId != nil {
240+
WaitForNatGatewayState(i.Context, *i.NatGateway.NatGatewayId, 180, "available")
241+
}
240242
if len(i.Subnets) == 2 {
241243
i.CreateRouteTable("public")
242244
i.CreateRouteTable("private")
243-
CreateRoute(i.Context, *i.State.PublicRouteTableID, "0.0.0.0/0", nil, i.InternetGateway.InternetGatewayId, nil)
244-
CreateRoute(i.Context, *i.State.PrivateRouteTableID, "0.0.0.0/0", i.NatGateway.NatGatewayId, nil, nil)
245-
i.GetRouteTable(*i.State.PublicRouteTableID)
246-
i.GetRouteTable(*i.State.PrivateRouteTableID)
245+
if i.InternetGateway != nil && i.InternetGateway.InternetGatewayId != nil {
246+
CreateRoute(i.Context, *i.State.PublicRouteTableID, "0.0.0.0/0", nil, i.InternetGateway.InternetGatewayId, nil)
247+
}
248+
if i.NatGateway != nil && i.NatGateway.NatGatewayId != nil {
249+
CreateRoute(i.Context, *i.State.PrivateRouteTableID, "0.0.0.0/0", i.NatGateway.NatGatewayId, nil, nil)
250+
}
251+
if i.State.PublicRouteTableID != nil {
252+
i.GetRouteTable(*i.State.PublicRouteTableID)
253+
}
254+
if i.State.PrivateRouteTableID != nil {
255+
i.GetRouteTable(*i.State.PrivateRouteTableID)
256+
}
247257
}
248258
return *i
249259
}

0 commit comments

Comments
 (0)