Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add unit test for scalable node group controller #157
Add unit test for scalable node group controller #157
Changes from all commits
ddd4dda
ac6d21d
cc6a9bd
66d5344
2b23031
b277a7e
099f647
32bfbaa
6c25eb0
22609c1
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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'm having a little trouble following the flow of the BeforeEach, Test, AfterEach logic. It looks like some logic is duplicated (i.e. sng.Spec.Replicas being set).
When I write these, I typically try to do everything in a BeforeEach loop, unless my test has mutated something that needs to be cleaned up after all of the tests.
I also think it might be cleaner to modify the fields of the CloudProvider factory, rather than using a singleton pattern on nodegroup and modifying that object directly. I think all you'd have to do is wire through the behavior of NodeGroupStabilized and NodeGroupStabilizedMessage to the CloudProvider factory, and then before each test, you can just do something like
Then when the factory creates the object, it will inject the behavior into the node group and should clean up most of your singleton/casting logic.
Let me know what you think to this approach.
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.
if I understand correctly, sng.Spec.ID is nil here, so this line is just muddying the water.
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.
sng.Spec.ID
is an empty string.This is required here, since, in my tests also
sng.Spec.ID
is always an empty string and NodeReplicas[""] is a Nil value if I don't set it which causesnodegroup.Replicas
to be also Nil.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.
+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.
Consider more idiomatic test naming with "It".
e.g. "it should scale up nodes", where the test name is "should scale up nodes".