Skip to content

Handle paginated Auto Scaling group listings - #33

Open
Cool-fire wants to merge 1 commit into
mainfrom
gambits/ses_7f09c4151b254e63-0eb4328967d2
Open

Handle paginated Auto Scaling group listings#33
Cool-fire wants to merge 1 commit into
mainfrom
gambits/ses_7f09c4151b254e63-0eb4328967d2

Conversation

@Cool-fire

Copy link
Copy Markdown
Owner

Why
The EC2 scaler only evaluated the first page returned by Auto Scaling group listing calls. In AWS accounts with more than one page of ASGs, later groups were skipped, which could lead the CLI to make scaling decisions from an incomplete set.

What changed

  • added a paginated ASG listing helper in pkg/service/ec2.go that keeps calling DescribeAutoScalingGroups until NextToken is empty
  • aggregate all ASGs before selecting the target group for EC2 scaling
  • added focused unit tests covering multi-page listing and scaling a group that only appears on a later page

Verification

  • gofmt -w "pkg/service/ec2.go" "pkg/service/ec2_test.go" could not be run in this sandbox because gofmt is not installed
  • go test ./... could not be run in this sandbox because go is not installed
  • make could not be run in this sandbox because go is not installed

Limitations

  • verification is blocked by the current environment missing the Go toolchain, so the PR is unverified in-sandbox despite the added test coverage in source

Files changed

pkg/service/ec2.go      |  53 +++++++++++++++++++++-
 pkg/service/ec2_test.go | 114 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 165 insertions(+), 2 deletions(-)

Session

View session

Generated by Gambits Staging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant