Skip to content

Fix mixed ASG capacity double counting - #32

Open
Cool-fire wants to merge 1 commit into
mainfrom
gambits/ses_6843a29e7a9f4e97-237f79d4064a
Open

Fix mixed ASG capacity double counting#32
Cool-fire wants to merge 1 commit into
mainfrom
gambits/ses_6843a29e7a9f4e97-237f79d4064a

Conversation

@Cool-fire

Copy link
Copy Markdown
Owner

This change adds a single EC2 ASG capacity-counting path that deduplicates instances by instance ID and only counts serving lifecycle states. That prevents mixed on-demand/spot groups from overstating current capacity when the same spot instance is observed more than once.

What changed:

  • add an Auto Scaling client interface in pkg/service/ec2.go so the EC2 service can be tested around ASG describe/update behavior
  • add countAutoScalingGroupCapacity to count unique, capacity-contributing instances exactly once
  • add focused regression tests for mixed on-demand/spot ASGs and for ignoring non-serving lifecycle states

Verification:

  • attempted make
  • result: failed in the sandbox because the Go toolchain is not installed (/bin/sh: 1: go: not found)

Limitations:

  • I could not run go test or build the binary in this environment because go is unavailable.

Files changed

pkg/service/ec2.go      | 65 ++++++++++++++++++++++++++++++++++++++++++++++++-
 pkg/service/ec2_test.go | 61 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 125 insertions(+), 1 deletion(-)

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