From 9aca5f8e4172105e022c11a3cd8cfba1ccd2d59c Mon Sep 17 00:00:00 2001 From: jay vyas Date: Thu, 10 Dec 2020 10:47:51 -0800 Subject: [PATCH] Update hybrid_network.go Add By clauses to windows networking test so that we always know where it failed and how --- test/e2e/windows/hybrid_network.go | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/test/e2e/windows/hybrid_network.go b/test/e2e/windows/hybrid_network.go index 2c28fe897eb..ea94b963d40 100644 --- a/test/e2e/windows/hybrid_network.go +++ b/test/e2e/windows/hybrid_network.go @@ -50,19 +50,27 @@ var _ = SIGDescribe("Hybrid cluster network", func() { ginkgo.Context("for all supported CNIs", func() { ginkgo.It("should have stable networking for Linux and Windows pods", func() { - ginkgo.By("creating linux and windows pods") + linuxPod := createTestPod(f, linuxBusyBoxImage, linuxOS) + ginkgo.By("creating a linux pod and waiting for it to be running") linuxPod = f.PodClient().CreateSync(linuxPod) + windowsPod := createTestPod(f, windowsBusyBoximage, windowsOS) + windowsPod.Spec.Containers[0].Args = []string{"test-webserver"} + ginkgo.By("creating a windows pod and waiting for it to be running") windowsPod = f.PodClient().CreateSync(windowsPod) + ginkgo.By("verifying pod external connectivity to the internet") + ginkgo.By("checking connectivity to 8.8.8.8 53 (google.com) from Linux") assertConsistentConnectivity(f, linuxPod.ObjectMeta.Name, linuxOS, linuxCheck("8.8.8.8", 53)) ginkgo.By("checking connectivity to www.google.com from Windows") assertConsistentConnectivity(f, windowsPod.ObjectMeta.Name, windowsOS, windowsCheck("www.google.com")) + ginkgo.By("verifying pod internal connectivity to the cluster dataplane") + ginkgo.By("checking connectivity from Linux to Windows") assertConsistentConnectivity(f, linuxPod.ObjectMeta.Name, linuxOS, linuxCheck(windowsPod.Status.PodIP, 80)) @@ -75,27 +83,28 @@ var _ = SIGDescribe("Hybrid cluster network", func() { }) var ( - duration = "10s" - pollInterval = "1s" - timeout = 10 // seconds + duration = "10s" + pollInterval = "1s" + timeoutSeconds = 10 ) func assertConsistentConnectivity(f *framework.Framework, podName string, os string, cmd []string) { gomega.Consistently(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()) } func linuxCheck(address string, port int) []string { - nc := fmt.Sprintf("nc -vz %s %v -w %v", address, port, timeout) + nc := fmt.Sprintf("nc -vz %s %v -w %v", address, port, timeoutSeconds) cmd := []string{"/bin/sh", "-c", nc} return cmd } func windowsCheck(address string) []string { - curl := fmt.Sprintf("curl.exe %s --connect-timeout %v --fail", address, timeout) + curl := fmt.Sprintf("curl.exe %s --connect-timeout %v --fail", address, timeoutSeconds) cmd := []string{"cmd", "/c", curl} return cmd }