Fixed failure of networking tests.
The default MTU on the pod network interface varies, depending
on the environment on which the cluster runs, and it made some
of the tests to fail.
Now the test covers all the possible MTU values.
@@ -164,11 +164,6 @@ var _ = Describe("[rfe_id:694][crit:medium][vendor:cnv-qe@redhat.com][level:comp
tests.SkipIfOpenShift("Custom MAC addresses on pod networks are not supported")
}
- // assuming pod network is of standard MTU = 1500 (minus 50 bytes for vxlan overhead)
- expectedMtu := 1450
- ipHeaderSize := 28 // IPv4 specific
- payloadSize := expectedMtu - ipHeaderSize
-
switch destination {
case "Internet":
addr = "kubevirt.io"
@@ -180,6 +175,9 @@ var _ = Describe("[rfe_id:694][crit:medium][vendor:cnv-qe@redhat.com][level:comp
addr = inboundVMIWithCustomMacAddress.Status.Interfaces[0].IP
}
+ payloadSize := 0
+ ipHeaderSize := 28 // IPv4 specific
+
By("checking k6t-eth0 MTU inside the pod")
vmiPod := tests.GetRunningPodByVirtualMachineInstance(outboundVMI, tests.NamespaceTestDefault)
output, err := tests.ExecuteCommandOnPod(
@@ -190,9 +188,25 @@ var _ = Describe("[rfe_id:694][crit:medium][vendor:cnv-qe@redhat.com][level:comp
)
log.Log.Infof("%v", output)
Expect(err).ToNot(HaveOccurred())
+
+ // The MTU of the Pod network varies, depending on the environment in use. We want to
+ // verify that the actual MTU is from the possible range, which is {1500, 1450}, minus
+ // 50 bytes for vxlan overhead.
+ possibleMtus := []int{1400, 1450}
+ mtuMatch := false
+ expectedMtuString := ""
+
+ for _, expectedMtu := range possibleMtus {
+ payloadSize = expectedMtu - ipHeaderSize
+
// the following substring is part of 'ip address show' output
- expectedMtuString := fmt.Sprintf("mtu %d", expectedMtu)
- Expect(strings.Contains(output, expectedMtuString)).To(BeTrue())
+ expectedMtuString = fmt.Sprintf("mtu %d", expectedMtu)
+ mtuMatch = strings.Contains(output, expectedMtuString)
+ if mtuMatch == true {
+ break
+ }
+ }
+ Expect(mtuMatch).To(BeTrue())
By("checking eth0 MTU inside the VirtualMachineInstance")
expecter, err := tests.LoggedInCirrosExpecter(outboundVMI)
