-
Notifications
You must be signed in to change notification settings - Fork 980
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
Fix bug in ec2 api mock #354
Conversation
wasn't resetting the list of fake ec2 instances when Reset was called
Turned out the problem was a little bigger than I thought, please re-review @ellistarn. Thanks! |
pkg/cloudprovider/aws/suite_test.go
Outdated
@@ -222,6 +222,9 @@ var _ = Describe("Allocation", func() { | |||
}) | |||
It("should launch separate instances for pods with different node selectors", func() { | |||
// Setup | |||
fakeEC2API.DescribeSubnetsOutput = &ec2.DescribeSubnetsOutput{Subnets: []*ec2.Subnet{ |
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.
Shouldn't there simply be a default subnet you can use in this test? I feel it shouldn't be necessary to specify this for this test.
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.
Fixed - good catch - turned out to be another bug in fakeEC2API
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 think the refactor looks good. I'm curious why we even need to reuse the FakeEC2API across tests and therefore need the Reset ability. Why can't we just use a new FakeEC2API on every test?
@bwagner5 I haven't looked at it that closely - I think it's to avoid re-creating the kubernetes environment for every individual test (which I think would be very slow?) - and the webhooks need to refer (indirectly) to the ec2 api. |
Issue #, if available: 273
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.