diff --git a/pkg/cloudprovider/aws/fake/ec2api.go b/pkg/cloudprovider/aws/fake/ec2api.go index 97913068eb01..d31385a77797 100644 --- a/pkg/cloudprovider/aws/fake/ec2api.go +++ b/pkg/cloudprovider/aws/fake/ec2api.go @@ -100,7 +100,11 @@ func (e *EC2API) DescribeSubnetsWithContext(context.Context, *ec2.DescribeSubnet if e.DescribeSubnetsOutput != nil { return e.DescribeSubnetsOutput, nil } - return &ec2.DescribeSubnetsOutput{Subnets: []*ec2.Subnet{{SubnetId: aws.String("test-subnet-1"), AvailabilityZone: aws.String("test-zone-1a")}}}, nil + return &ec2.DescribeSubnetsOutput{Subnets: []*ec2.Subnet{ + {SubnetId: aws.String("test-subnet-1"), AvailabilityZone: aws.String("test-zone-1a")}, + {SubnetId: aws.String("test-subnet-2"), AvailabilityZone: aws.String("test-zone-1b")}, + {SubnetId: aws.String("test-subnet-3"), AvailabilityZone: aws.String("test-zone-1c")}, + }}, nil } func (e *EC2API) DescribeSecurityGroupsWithContext(context.Context, *ec2.DescribeSecurityGroupsInput, ...request.Option) (*ec2.DescribeSecurityGroupsOutput, error) { diff --git a/pkg/cloudprovider/aws/suite_test.go b/pkg/cloudprovider/aws/suite_test.go index f489e7715a58..c95f9d76a153 100644 --- a/pkg/cloudprovider/aws/suite_test.go +++ b/pkg/cloudprovider/aws/suite_test.go @@ -136,11 +136,6 @@ var _ = Describe("Allocation", func() { Context("Reconciliation", func() { It("should default to a cluster zone", func() { - fakeEC2API.DescribeSubnetsOutput = &ec2.DescribeSubnetsOutput{Subnets: []*ec2.Subnet{ - {SubnetId: aws.String("test-subnet-1"), AvailabilityZone: aws.String("test-zone-1a")}, - {SubnetId: aws.String("test-subnet-2"), AvailabilityZone: aws.String("test-zone-1b")}, - {SubnetId: aws.String("test-subnet-3"), AvailabilityZone: aws.String("test-zone-1c")}, - }} // Setup pod := test.PendingPod() ExpectCreatedWithStatus(env.Client, pod) @@ -167,11 +162,6 @@ var _ = Describe("Allocation", func() { )) }) It("should default to a provisioner's zone", func() { - fakeEC2API.DescribeSubnetsOutput = &ec2.DescribeSubnetsOutput{Subnets: []*ec2.Subnet{ - {SubnetId: aws.String("test-subnet-1"), AvailabilityZone: aws.String("test-zone-1a")}, - {SubnetId: aws.String("test-subnet-2"), AvailabilityZone: aws.String("test-zone-1b")}, - {SubnetId: aws.String("test-subnet-3"), AvailabilityZone: aws.String("test-zone-1c")}, - }} // Setup provisioner.Spec.Zones = []string{"test-zone-1a", "test-zone-1b"} pod := test.PendingPod() @@ -196,11 +186,6 @@ var _ = Describe("Allocation", func() { ) }) It("should allow pod to override default zone", func() { - fakeEC2API.DescribeSubnetsOutput = &ec2.DescribeSubnetsOutput{Subnets: []*ec2.Subnet{ - {SubnetId: aws.String("test-subnet-1"), AvailabilityZone: aws.String("test-zone-1a")}, - {SubnetId: aws.String("test-subnet-2"), AvailabilityZone: aws.String("test-zone-1b")}, - {SubnetId: aws.String("test-subnet-3"), AvailabilityZone: aws.String("test-zone-1c")}, - }} // Setup provisioner.Spec.Zones = []string{"test-zone-1a", "test-zone-1b"} pod := test.PendingPodWith(test.PodOptions{NodeSelector: map[string]string{v1alpha1.ZoneLabelKey: "test-zone-1c"}})