Skip to content
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

Merged
merged 5 commits into from
Apr 9, 2021
Merged

Fix bug in ec2 api mock #354

merged 5 commits into from
Apr 9, 2021

Conversation

JacobGabrielson
Copy link
Contributor

Issue #, if available: 273

Description of changes:

  • wasn't resetting the list of fake ec2 instances when Reset was called

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

wasn't resetting the list of fake ec2 instances when Reset was called
ellistarn
ellistarn previously approved these changes Apr 9, 2021
@JacobGabrielson
Copy link
Contributor Author

Turned out the problem was a little bigger than I thought, please re-review @ellistarn. Thanks!

@@ -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{
Copy link
Contributor

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.

Copy link
Contributor Author

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

bwagner5
bwagner5 previously approved these changes Apr 9, 2021
Copy link
Contributor

@bwagner5 bwagner5 left a 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?

@JacobGabrielson
Copy link
Contributor Author

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.

@JacobGabrielson JacobGabrielson merged commit e335f87 into aws:main Apr 9, 2021
@JacobGabrielson JacobGabrielson deleted the lt4 branch April 9, 2021 18:31
gfcroft pushed a commit to gfcroft/karpenter-provider-aws that referenced this pull request Nov 25, 2023
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.

3 participants