-
Notifications
You must be signed in to change notification settings - Fork 110
Support AZs list #8
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
Conversation
…nce types across multiple zones
Codecov Report
@@ Coverage Diff @@
## master #8 +/- ##
==========================================
+ Coverage 89.44% 89.60% +0.15%
==========================================
Files 7 7
Lines 758 779 +21
==========================================
+ Hits 678 698 +20
Misses 53 53
- Partials 27 28 +1
Continue to review full report at Codecov.
|
pkg/selector/selector.go
Outdated
if isZoneID, _ := regexp.MatchString(zoneIDRegex, zone); isZoneID { | ||
instanceTypeOfferingsInput.SetLocationType(zoneIDLocationType) | ||
} else if isZoneName, _ := regexp.MatchString(zoneNameRegex, zone); isZoneName { | ||
instanceTypeOfferingsInput.SetLocationType(zoneNameLocationType) | ||
} else if isRegion, _ := regexp.MatchString(regionNameRegex, zone); isRegion { | ||
instanceTypeOfferingsInput.SetLocationType(regionNameLocationType) | ||
} else { | ||
return nil, fmt.Errorf("The location passed in (%s) is not a valid zone-id, zone-name, or region name", zone) | ||
} |
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.
could be nicer to pull this out to a helper func
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.
good call, done!
pkg/selector/selector.go
Outdated
if _, ok := availableInstanceTypes[*instanceType.InstanceType]; !ok { | ||
availableInstanceTypes[*instanceType.InstanceType] = 1 | ||
} else { | ||
i, _ := availableInstanceTypes[*instanceType.InstanceType] | ||
availableInstanceTypes[*instanceType.InstanceType] = i + 1 | ||
} |
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.
I feel like this isn't the cleanest way to write this since you're splitting i, ok := availableInstanceTypes[*instanceType.InstanceType]
into two parts, but my brain isn't working right now to come up with a nicer implementation
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.
ha yeah, you're right! I fixed it since the i
is still in scope of the if... :)
h.Ok(t, err) | ||
h.Assert(t, len(results) == 3, "c4.large should return 3 similar instance types") | ||
} | ||
|
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.
what happens when there's a mix of good + bad AZs?
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.
also duplicate AZs?
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.
added tests to ensure these cases work 🕺
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.
LGTM
Issue #, if available:
N/A
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.