-
Notifications
You must be signed in to change notification settings - Fork 14
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
deployment CR reconcile of containers #92
Conversation
Changes looks good 👍 Any thoughts on adding a controller test for this also? 🤔 |
Issue the only containers that are managed by the limitador-operator can be added to the limitador deployment CR.
616c77f
to
175cbf0
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.
This looks good to me 👍
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
however one question before giving my approval.
So far, we have been using Ginkgo for e2e tests in controllers
package. For the remaining packages we have been using Golang builtin testing framework. To be honest, I do not remember the rationale for that. Is there any drawback you can think about breaking this internal convention?
var desired *appsv1.Deployment | ||
|
||
BeforeEach(func() { | ||
desired = &appsv1.Deployment{ |
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.
nitpick: this approach is not wrong perse. However I find less robust than defining a function to return the object
func myFancyDeployment() *appsv1.Deployment {
return &appsv1.Deployment{
....
}
}
"Robust" meaning less prone to errors like forgetting to set the new value or being nil
for whatever reason.
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 don't see this to be less robust. The beforeEach ensures the desired deployment is set before each test context and a test context has to actively change the deployment if the test context requires some else. I find if there is a function that returns a default set up (deployment in this case) people tend to start adding logic to the function to handle different cases which kinda makes it pointless to have a default.
I am not sure what the ask is here. If you want me to rewrite the test to suit go test as in the other comment this would be gone so nothing is needed. But if the rewrite is not need I am not sure what change you are asking me to do.
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.
no changes requested. Just a comment to refactor to something else. Since you do not agree with me, as I said this is not wrong, thus nothing to be done here.
If ginkgo is only to be used for e2e tests I don't mind switching the golang built in test framework. When it comes to the drawbacks of using one over the other. Personal I like ginkgo. Being able to configure the beforeEach and afterEach on at every level is great and allows for clean tests as the test set ups do not need to be part of the test case. Using Gomega which goes hand in hand ginkgo, puts a clear understanding in the test case but of course Gomega can be used as part with the standard test frame work. Some other features of ginkgo that super usefully is being able to randomize not only the test suites but all the tests with a suite. This can highlight flaky tests. There is a also the retry function that can be added to know flaky tests. Being able to build a binary of the test suite would be more usefully for sharing e2e test images with qe. I will mention that Ginkgo does allow running test in parallel, while this can be done in gotest it does require code changes. So then why use go test. There is better support for go test in IDEs. For instances goland can generate the test skeleton for a function which the user only has to add test case to. This make is super easy to get unit test up and working. But the biggest advantage is it is part of the language. I am all for using one style. @eguzki not sure if I answered your question. Do you want me to rewrite the test I created to use the go test framework? |
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.
let's go with this. 🚀
Ensure that only containers that are managed by the limitador-operator can be added to the limitador deployment CR.
Verification
Resolves #90