diff --git a/pkg/lookable/asg.go b/pkg/lookable/asg.go index 3aeeaea..70bac94 100644 --- a/pkg/lookable/asg.go +++ b/pkg/lookable/asg.go @@ -57,8 +57,6 @@ func (asg AutoScalingGroup) doLookupIPs(as ASGAPI, ec EC2API, ctx context.Contex // No healthy instances if len(instances) == 0 { return nil, nil - } - // Find running instances IP params3 := &ec2.DescribeInstancesInput{ diff --git a/pkg/lookable/asg_test.go b/pkg/lookable/asg_test.go index 04d7260..7856ca1 100644 --- a/pkg/lookable/asg_test.go +++ b/pkg/lookable/asg_test.go @@ -25,7 +25,9 @@ func TestLookupASG(t *testing.T) { /* Single instance result */ { client: func(t *testing.T) (ASGAPI,EC2API) { - instanceId := "inst-2016584701" + instanceId1 := "inst-2016584701" + instanceId2 := "inst-2016584702" + instanceId2 := "inst-2016584703" return &MockASGAPI{ DescribeAutoScalingGroupsMethod: func(ctx context.Context, params *autoscaling.DescribeAutoScalingGroupsInput, optFns...func(*autoscaling.Options)) (*autoscaling.DescribeAutoScalingGroupsOutput, error) { @@ -38,7 +40,19 @@ func TestLookupASG(t *testing.T) { { Instances: []asgtypes.Instance{ { - InstanceId: &instanceId, + InstanceId: &instanceId1, + HealthStatus: "Healthy", + LifeCycleState: "InService", + }, + { + InstanceId: &instanceId2, + HealthStatus: "Degraded", + LifeCycleState: "Pending", + }, + { + InstanceId: &instanceId3, + HealthStatus: "Healthy", + LifeCycleState: "Terminating", }, }, },