Skip to content

Commit

Permalink
Fix more problems
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed Feb 8, 2024
1 parent fc1888b commit cf577b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cmd/sync/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,13 @@ func (client *AWSClient) getInstancesInService(insIDtoIP map[string]string) ([]s
const maxItems = 50
var result []string
keys := reflect.ValueOf(insIDtoIP).MapKeys()
instanceIds := make([]string, len(keys))
instanceIDs := make([]string, len(keys))

for i := 0; i < len(keys); i++ {
instanceIds[i] = keys[i].String()
instanceIDs[i] = keys[i].String()
}

batches := prepareBatches(maxItems, instanceIds)
batches := prepareBatches(maxItems, instanceIDs)
for _, batch := range batches {
params := &autoscaling.DescribeAutoScalingInstancesInput{
InstanceIds: batch,
Expand Down
6 changes: 3 additions & 3 deletions cmd/sync/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ func areEqualUpstreamsAWS(u1 awsUpstream, u2 Upstream) bool {
func TestPrepareBatches(t *testing.T) {
const maxItems = 3
ids := []string{"i-394ujfs", "i-dfdinf", "i-fsfsf", "i-8hr83hfwif", "i-nsnsnan"}
instanceIds := make([]string, len(ids))
instanceIDs := make([]string, len(ids))

copy(instanceIds, ids)
copy(instanceIDs, ids)

batches := prepareBatches(maxItems, instanceIds)
batches := prepareBatches(maxItems, instanceIDs)

if len(batches) > len(ids)/maxItems+1 {
t.Error("prepareBatches() didn't split the slice correctly")
Expand Down

0 comments on commit cf577b2

Please sign in to comment.