tests: Wait for the network connectivity first

Some tests are checking the network connectivity using gomega.Consistently,
which will fail if any of the checks fails. This could lead to flakyness in
some scenarios in which kube-proxy was supposed to apply Policies for
Kubernetes services.

We can instead wait for the network connectivity to work first using gomega.Eventually,
after which we can check the consistency.
This commit is contained in:
Claudiu Belu 2021-06-25 00:56:37 -07:00
parent 7b24c7e4a7
commit 9accb994df

View File

@ -89,12 +89,14 @@ var (
)
func assertConsistentConnectivity(f *framework.Framework, podName string, os string, cmd []string) {
gomega.Consistently(func() error {
connChecker := func() error {
ginkgo.By(fmt.Sprintf("checking connectivity of %s-container in %s", os, podName))
// TODO, we should be retrying this similar to what is done in DialFromNode, in the test/e2e/networking/networking.go tests
_, _, err := f.ExecCommandInContainerWithFullOutput(podName, os+"-container", cmd...)
return err
}, duration, pollInterval).ShouldNot(gomega.HaveOccurred())
}
gomega.Eventually(connChecker, duration, pollInterval).ShouldNot(gomega.HaveOccurred())
gomega.Consistently(connChecker, duration, pollInterval).ShouldNot(gomega.HaveOccurred())
}
func linuxCheck(address string, port int) []string {