-
Notifications
You must be signed in to change notification settings - Fork 238
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
test/e2e: more flexible pod spec generation #964
test/e2e: more flexible pod spec generation #964
Conversation
✅ Deploy Preview for kubernetes-sigs-nfd ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
/assign @ArangoGutierrez @fmuyassarov ping @Tal-or |
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.
Very nice.
A small enhancement proposal from me about readability:
You can have a separate package named pod
or podspec
under utils
and place NFDWorkerPod
NFDMasterPod
, etc. functions there.
Then you can rename the functions and call them from the tests in the following manner:
instead of:
testutils.NFDWorkerPod(opts...)
testutils.NFDMasterPod(opts...)
testutils.SpecWithContainerImage(...)
You'll have:
pod.NFDWorker(opts...)
pod.NFDMaster(opts...)
pod.SpecWithContainerImage(...)
It will keep the names shorter, clearer, and make the package more isolated and portable
Thanks for the review @Tal-or
Good note, I agree. How about doing this refactoring in a separate PR? I think there are other things to be done on this front, e.g. separating the daemonset functionality in a separate package (or a separate file at least). Another thing that I spotted was that we could simplify the "sleeper pod" creation, basically set resource limits with a dedicated |
Sure. I can handle it if you want. |
Unknown CLA label state. Rechecking for CLA labels. Send feedback to sig-contributor-experience at kubernetes/community. /check-cla |
Yeah, sure go ahead. Would be appreciated 👍 |
Change the pod spec generator functions to accept parameterization in the form of more generic "mutator functions". This makes the addition of new test specific pod spec customizations a lot cleaner. Plus, hopefully makes the code a bit more readable as well. Also, slightly simplify the SpecWithConfigMap() but dropping one redundant argument. Inspired by latest contributions by Talor Itzhak (titzhak@redhat.com).
0cc7879
to
1719ce6
Compare
Updated the PR, converting nfd-worker tests to also use |
@Tal-or so I suggest to merge this PR with its current scope/content and submit further enhancements as separate PRs? Makes also review easier as smaller diffstat per PR. |
Sure, go ahead |
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ArangoGutierrez, marquiz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Change the pod spec generator functions to accept parameterization in
the form of more generic "mutator functions". This makes the addition of
new test specific pod spec customizations a lot cleaner. Plus, hopefully
makes the code a bit more readable as well.
Also, slightly simplify the SpecWithConfigMap() but dropping one
redundant argument.
Inspired by latest contributions by Talor Itzhak (titzhak@redhat.com).