From 9accb994dff9dfbcfa582cc53f76d77b94506cc8 Mon Sep 17 00:00:00 2001 From: Claudiu Belu Date: Fri, 25 Jun 2021 00:56:37 -0700 Subject: [PATCH] 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. --- test/e2e/windows/hybrid_network.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/e2e/windows/hybrid_network.go b/test/e2e/windows/hybrid_network.go index 5e57a8c4c9d..7a133b29044 100644 --- a/test/e2e/windows/hybrid_network.go +++ b/test/e2e/windows/hybrid_network.go @@ -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 {