Closed Hong-Chang closed 3 years ago
Can we please add unit tests? While it looks OK to me, I think I'll rely on Cathy signing off for this.
Can we please add unit tests? While it looks OK to me, I think I'll rely on Cathy signing off for this.
There is no unit test for this part. For networkpolicy util, originally we should create multiple modules in different layers and it will be easy for unit test. But later we decided to put only one file so it's not unit testable.
LGTM
/lgtm
Can we please add unit tests? While it looks OK to me, I think I'll rely on Cathy signing off for this.
Looked again, there is no unit tests at all. We need to add unit testing to all the code in next release.
What does this PR do? When there is network policy created or updated, create corresponding label based data. The data will be sent into XDP tables in later code. The calculated data is "pod_label_policy_table", "namespace_label_policy_table" and "pod_and_namespace_label_policy_table". The sample calculated data looks like followed: "pod_label_policy_table": [ {"pod_label_value": 13, "bit_value": 3}, {"pod_label_value": 14, "bit_value": 3}, ], "namespace_label_policy_table": [ {"namespace_label_value": 2, "bit_value": 3}, {"namespace_label_value": 3, "bit_value": 1}, ], "pod_and_namespace_label_policy_table": [ {"pod_label_value": 13, "namespace_label_value": 2, "bit_value": 3}, {"pod_label_value": 13, "namespace_label_value": 3, "bit_value": 3}, {"pod_label_value": 14, "namespace_label_value": 2, "bit_value": 3}, {"pod_label_value": 14, "namespace_label_value": 3, "bit_value": 3}, ]
How was this tested? I did manual e2e test and verified the calculated data is correct.
Are there any user facing / API changes? No.