-
Notifications
You must be signed in to change notification settings - Fork 29
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
cnf-network: add multi-netpolicy tests for ipvlan cni #345
Conversation
By("Enable MultiNetworkPolicy support") | ||
enableMultiNetworkPolicy(true) | ||
|
||
By("Deploy Test Resources: 2 Namespaces") |
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.
IMO rather then the number 2 use two.
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.
Ok. Updated.
WithLabel("ns", "ns2").Create() | ||
Expect(err).ToNot(HaveOccurred(), "Failed to create test namespace") | ||
|
||
By("Deploy Test Resources: 2 NADs for IPVLAN CNI") |
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.
same here By("Deploy Test Resources: two NADs for IPVLAN CNI"
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.
Updated.
defineAndCreateIpvlanNAD("ipvlan", testNs1, sriovInterfacesUnderTest[0]) | ||
defineAndCreateIpvlanNAD("ipvlan", testNs2, sriovInterfacesUnderTest[1]) | ||
|
||
By("Deploy Test Resources: 5 Pods") |
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.
It is generally best to write out numbers from zero to 10 in technical writing. So that goes for where ever you used numbers rather then writing them out. Up to you.
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.
Ok, Updated accordingly.
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.
several minor comments
|
||
const ( | ||
testNs1, testNs2 = "policy-ns1", "policy-ns2" | ||
pod1, pod2, pod3, pod4, pod5 = "pod1", "pod2", "pod3", "pod4", "pod5" |
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 can see only one time use. If it's true remove var, if not please rename var to podname1
|
||
By("Check ingress traffic to pod1 from other four pods. All ports should be open") | ||
|
||
verifyPaths(testPod2, testPod1, allOpen, allOpen, testData) |
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.
Could you move all common func to the internal folder or create a common.go (check the metallb implementation)?
var ( | ||
sriovInterfacesUnderTest []string | ||
tNs1, tNs2 *namespace.Builder | ||
testPod1, testPod2, testPod3, testPod4, testPod5 *pod.Builder | ||
ports = []string{"5001", "5002", "5003"} | ||
protocols = []string{"tcp", "tcp", "udp"} | ||
allOpen = map[string]string{"5001": "pass", "5002": "pass", "5003": "pass"} | ||
allClose = map[string]string{"5001": "fail", "5002": "fail", "5003": "fail"} | ||
p5001Open = map[string]string{"5001": "pass", "5002": "fail", "5003": "fail"} | ||
p5001p5002Open = map[string]string{"5001": "pass", "5002": "pass", "5003": "fail"} | ||
) | ||
|
||
const ( | ||
testNs1, testNs2 = "policy-ns1", "policy-ns2" | ||
pod1, pod2, pod3, pod4, pod5 = "pod1", "pod2", "pod3", "pod4", "pod5" | ||
) | ||
|
||
testData := podsData{ | ||
"pod1": {IPv4: "192.168.10.10/24", IPv6: "2001:0:0:1::10/64", Protocols: protocols, Ports: ports}, | ||
"pod2": {IPv4: "192.168.10.11/24", IPv6: "2001:0:0:1::11/64", Protocols: protocols, Ports: ports}, | ||
"pod3": {IPv4: "192.168.10.12/24", IPv6: "2001:0:0:1::12/64", Protocols: protocols, Ports: ports}, | ||
"pod4": {IPv4: "192.168.20.11/24", IPv6: "2001:0:0:2::11/64", Protocols: protocols, Ports: ports}, | ||
"pod5": {IPv4: "192.168.20.12/24", IPv6: "2001:0:0:2::12/64", Protocols: protocols, Ports: ports}, | ||
} |
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.
It looks like you used very similar var and const in the bond tests. If so, could you move them to the internal folder?
defineAndCreateIpvlanNAD("ipvlan", testNs1, sriovInterfacesUnderTest[0]) | ||
defineAndCreateIpvlanNAD("ipvlan", testNs2, sriovInterfacesUnderTest[1]) |
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.
defineAndCreateIpvlanNAD("ipvlan", testNs1, sriovInterfacesUnderTest[0]) | |
defineAndCreateIpvlanNAD("ipvlan", testNs2, sriovInterfacesUnderTest[1]) | |
defineAndCreateIpvlanNAD(testNs1, sriovInterfacesUnderTest[0]) | |
defineAndCreateIpvlanNAD(testNs2, sriovInterfacesUnderTest[1]) |
defineAndCreateIpvlanNAD("ipvlan", testNs2, sriovInterfacesUnderTest[1]) | ||
|
||
By("Deploy Test Resources: Five Pods") | ||
testPod1 = defineAndCreatePodWithIpvlanIf(pod1, testNs1, workerNodeList[0].Object.Name, testData) |
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.
testPod1 = defineAndCreatePodWithIpvlanIf(pod1, testNs1, workerNodeList[0].Object.Name, testData) | |
testPod1 = defineAndCreatePodWithIpvlanIf(pod1, testNs1, testData) |
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.
1 minor comment.
// AllClose represents that all what ports are expected to be open for policy tests. | ||
AllClose = map[string]string{"5001": "fail", "5002": "fail", "5003": "fail"} | ||
// P5001Open represents that all what ports are expected to be open for policy tests. | ||
P5001Open = map[string]string{"5001": "pass", "5002": "fail", "5003": "fail"} | ||
// P5001p5002Open represents that all what ports are expected to be open for policy tests. | ||
P5001p5002Open = map[string]string{"5001": "pass", "5002": "pass", "5003": "fail"} |
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.
Please fix the comments
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.
done
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 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
multinetpolicy_ipvlan.go
Multi-NetworkPolicy IPVLAN CNI Tests