-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Acpq quota overrides bug #654
base: master
Are you sure you want to change the base?
Conversation
1c277c9
to
ffd0710
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice. I only have a few small nitpicks:
} | ||
|
||
func TestMinQuotaConstraintWithLargeNumbers(t *testing.T) { | ||
// This tests how min quota overwrites deals with very large numbers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo:
// This tests how min quota overwrites deals with very large numbers | |
// This tests how min quota overrides deals with very large numbers |
// Quota should not be assgined to ANY AZ on AZ aware resources. This causes unusable quota distribution on manual quota overrides. | ||
resourceAZs := allAZs | ||
if isAZAware { | ||
resourceAZs = append([]limes.AvailabilityZone{}, allAZs...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This used to be the idiomatic way to clone a slice, but a standard library function has been added recently:
resourceAZs = append([]limes.AvailabilityZone{}, allAZs...) | |
resourceAZs = slices.Clone(allAZs) |
} | ||
} | ||
} | ||
missingQuota := subtractOrZero(*c.MinQuota, totalAllocated) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This made me notice that we have another instance of subtract-or-zero here. While we're at it, please replace subtractOrZero()
with liquidapi.SaturatingSub()
to reduce code duplication.
if az == limes.AvailabilityZoneAny && isAZAware { | ||
continue | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this check necessary? When initializing resourceAZs
at the top of the function, we already filter out any
if isAZAware
.
Checklist: