Skip to content

Commit

Permalink
Fix UT
Browse files Browse the repository at this point in the history
Signed-off-by: Aswin Suryanarayanan <[email protected]>
  • Loading branch information
aswinsuryan authored and Jaanki committed Nov 13, 2024
1 parent ee90732 commit cfa7f1c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/aws/aws_cloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func testOpenPorts() {

JustBeforeEach(func() {
t.expectDescribeVpcs(t.vpcID)
t.expectDescribeVpcsSigs(t.vpcID)
t.expectDescribePublicSubnets(t.subnets...)

retError = t.cloud.OpenPorts([]api.PortSpec{
Expand Down Expand Up @@ -116,6 +117,7 @@ func testClosePorts() {

JustBeforeEach(func() {
t.expectDescribeVpcs(t.vpcID)
t.expectDescribeVpcsSigs(t.vpcID)
t.expectDescribePublicSubnets(t.subnets...)
t.expectDescribePublicSubnetsSigs(t.subnets...)

Expand Down
18 changes: 17 additions & 1 deletion pkg/aws/aws_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,24 @@ func (f *fakeAWSClientBase) expectDescribeVpcs(vpcID string) {
}, types.Filter{
Name: awssdk.String(clusterFilterTagName),
Values: []string{"owned"},
})).Return(&ec2.DescribeVpcsOutput{Vpcs: vpcs}, nil).AnyTimes()
}

func (f *fakeAWSClientBase) expectDescribeVpcsSigs(vpcID string) {
var vpcs []types.Vpc
if vpcID != "" {
vpcs = []types.Vpc{
{
VpcId: ptr.To(vpcID),
},
}
}

f.awsClient.EXPECT().DescribeVpcs(gomock.Any(), eqFilters(types.Filter{
Name: ptr.To("tag:Name"),
Values: []string{infraID + "-vpc"},
}, types.Filter{
Name: ptr.To(providerAWSTagPrefix + infraID),
Name: ptr.To(clusterFilterTagNameSigs),
Values: []string{"owned"},
})).Return(&ec2.DescribeVpcsOutput{Vpcs: vpcs}, nil).AnyTimes()
}
Expand Down
1 change: 1 addition & 0 deletions pkg/aws/ocpgwdeployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ func newGatewayDeployerTestDriver() *gatewayDeployerTestDriver {
t.expectDescribeInstances(instanceImageID)
t.expectDescribeSecurityGroups(workerSGName, workerGroupID)
t.expectDescribePublicSubnets(t.subnets...)
t.expectDescribeVpcsSigs(t.vpcID)
t.expectDescribePublicSubnetsSigs(t.subnets...)

var err error
Expand Down

0 comments on commit cfa7f1c

Please sign in to comment.