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
Mock and unit testcases added for windows kube-proxy. #111031
Mock and unit testcases added for windows kube-proxy. #111031
Conversation
@princepereira: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Welcome @princepereira! |
Hi @princepereira. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
7685d57
to
07dbeb5
Compare
07dbeb5
to
d9c29a1
Compare
/sig windows |
alternative/related to #110749 |
f146a1d
to
fa7289a
Compare
) | ||
|
||
// mockHCN saves the created endpoints and loadbalancers in slices to be able to work with them easier | ||
type mockHCN struct { |
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.
Is there a reason to mock all the hcnUtils? To my understanding all of these are helpers that ultimately call into HCN.
Would it perhaps be better to only mock all of the hcsshim/HCN signature that the hcnUtils use? Store any of the created endpoints/loadbalancers as part of the "HCN" mock in memory and remove the structs/interfaces that mock hcnUtils. Tests and proxier code would use the same hcnUtils code.
hcnUtils for tests would initialize the hcn mock package which store artificial endpoints/loadbalancers, and real proxier code would use hcnUtils that initializes/references real hcn package.
Maybe I am missing something but feels to me this might reduce a layer of abstraction and make the code easier to understand, without reducing robustness of tests. Curious to hear your thoughts?
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.
hcnUtils is the final place where the test cases have control to mock the function call in the existing implementation. Considering an example of network.createEndpoint():
network.createEndpoint() -Calls-> createEndpoint [Which is in hcn package of vendor directory] -Calls-> hcnOpenNetwork [Which is in hcn package of vendor directory] -Calls-> syscall.Syscall
If you have a look at the above call flow, test code dont have any handle to avoid the syscall. That's the reason behind mocking hncUtils.
And sorry for the delay in responding, missed out the comment somehow.
57d7875
to
f525859
Compare
@daschott , Please review the code when you get a chance. |
@princepereira: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/milestone v1.27 |
If you still need this PR then please rebase, if not, please close the PR |
If you still need this PR then please remove the merge commits (see bot comment above), if not, please close the PR |
/cc @claudiubelu |
/assign |
@princepereira @claudiubelu HI! Release Bug Triage Shadow here. This PR hasn't been updated in 3 months. I just wanted to check if this is still on track for 1.27 release? |
Hi @princepereira! K8s 1.27 Bug Triage Shadow here again. |
@princepereira please rebase! |
/milestone clear since this is touching code outside of test files after code freeze |
Please remove merge commits, rebase and reopen this PR if necessary. It will not be merged as-is |
What type of PR is this?
/kind cleanup
/kind failing-test
/kind windows
/kind kube-proxy
What this PR does / why we need it:
This is to add mock and unit tests for windows kube-proxy
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: