-
Notifications
You must be signed in to change notification settings - Fork 260
[NPM]Make order of iptables entries in UT determinisitc in case of MultipleLabelsToMultipleLabels #941
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
Conversation
…LabelsToMultipleLabels
vakalapa
left a comment
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
|
There is another issue in this PR (sorted one can cause incorrect results as well). I will update the issue in details and codes according to the issue. The issue of previous commit is to sort all strings in specs of ipentries. So, if translation function returns incorrect values, they are sorted and possible to be match with expected values. Note: before merging it, I need to check "expectedLists" values to see whether they have the same issues or not. |
"There is another issue in this PR (sorted one can cause incorrect results as well). I will update the issue in details and codes according to the issue."
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
Close now. I am working on fixing this issue in another PR (refactoring translatePolicy.go) which fundamentally fixes this issue while there are reusable commits here. I will revisit them in the other PR. |
Reason for Change:
TestAllowMultiplePodSelectors has a flake UT result due to the ordering of ipset in Specs since the order of all ipset values in Specs is not guaranteed in MultiplePodSelectors case.
Thus, in this UT, before checking the iptables entries, sorting Specs is necessary before comparing them.
You can break this UT with this script without this PR.
Issue Fixed:
Requirements:
Notes:
While we have one UT to be sorted in current UTs, we need to generalize this approach in all tests to avoid undeterministic behavior in the added UTs in the future. In addition, I feel like we need to clean up translatePolicy_test.go since it is unnecessarily too lengthy.