Skip to content

Commit 5d22fe2

Browse files
committed
fixup! Support IP address type changes on update
Signed-off-by: Nolan Brubaker <nolan@nbrubaker.com>
1 parent 573c4ca commit 5d22fe2

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

pkg/providers/v1/aws_fakes.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434
elb "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing"
3535
elbtypes "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing/types"
3636
elbv2 "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2"
37+
elbv2types "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2/types"
3738
"github.com/aws/aws-sdk-go-v2/service/kms"
3839
"k8s.io/klog/v2"
3940

@@ -681,7 +682,8 @@ func (e *FakeELB) ModifyLoadBalancerAttributes(ctx context.Context, input *elb.M
681682

682683
// FakeELBV2 is a fake ELBV2 client used for testing
683684
type FakeELBV2 struct {
684-
aws *FakeAWSServices
685+
aws *FakeAWSServices
686+
IpAddressType elbv2types.IpAddressType
685687
}
686688

687689
// AddTags is not implemented but is required for interface conformance
@@ -715,9 +717,10 @@ func (elb *FakeELBV2) SetSecurityGroups(ctx context.Context, input *elbv2.SetSec
715717
panic("Not implemented")
716718
}
717719

718-
// SetIpAddressType is not implemented but is required for interface conformance
720+
// SetIpAddressType stores the given IpAddressType for later inspection and returns success.
719721
func (elb *FakeELBV2) SetIpAddressType(ctx context.Context, input *elbv2.SetIpAddressTypeInput, optFns ...func(*elbv2.Options)) (*elbv2.SetIpAddressTypeOutput, error) {
720-
panic("Not implemented")
722+
elb.IpAddressType = input.IpAddressType
723+
return &elbv2.SetIpAddressTypeOutput{IpAddressType: input.IpAddressType}, nil
721724
}
722725

723726
// ModifyLoadBalancerAttributes is not implemented but is required for interface conformance

pkg/providers/v1/aws_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2518,6 +2518,7 @@ func (m *MockedFakeELBV2) CreateLoadBalancer(ctx context.Context, input *elbv2.C
25182518
LoadBalancerArn: aws.String(arn),
25192519
LoadBalancerName: input.Name,
25202520
Type: elbv2types.LoadBalancerTypeEnumNetwork,
2521+
IpAddressType: input.IpAddressType,
25212522
VpcId: aws.String("vpc-abc123def456abc78"),
25222523
AvailabilityZones: []elbv2types.AvailabilityZone{
25232524
{
@@ -2588,6 +2589,17 @@ func (m *MockedFakeELBV2) DeleteLoadBalancer(ctx context.Context, input *elbv2.D
25882589
panic("Not implemented")
25892590
}
25902591

2592+
func (m *MockedFakeELBV2) SetIpAddressType(ctx context.Context, input *elbv2.SetIpAddressTypeInput, optFns ...func(*elbv2.Options)) (*elbv2.SetIpAddressTypeOutput, error) {
2593+
for _, lb := range m.LoadBalancers {
2594+
if aws.ToString(lb.LoadBalancerArn) == aws.ToString(input.LoadBalancerArn) {
2595+
lb.IpAddressType = input.IpAddressType
2596+
break
2597+
}
2598+
}
2599+
m.FakeELBV2.IpAddressType = input.IpAddressType
2600+
return &elbv2.SetIpAddressTypeOutput{IpAddressType: input.IpAddressType}, nil
2601+
}
2602+
25912603
func (m *MockedFakeELBV2) ModifyLoadBalancerAttributes(ctx context.Context, input *elbv2.ModifyLoadBalancerAttributesInput, optFns ...func(*elbv2.Options)) (*elbv2.ModifyLoadBalancerAttributesOutput, error) {
25922604
attrMap, present := m.LoadBalancerAttributes[aws.ToString(input.LoadBalancerArn)]
25932605

0 commit comments

Comments
 (0)