diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index bfc1deab145..2dcb56955e3 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -4503,15 +4503,22 @@ func LaunchWebserverPod(f *Framework, podName, nodeName string) (ip string) { return } +type PingCommand string + +const ( + IPv4PingCommand PingCommand = "ping" + IPv6PingCommand PingCommand = "ping6" +) + // CheckConnectivityToHost launches a pod to test connectivity to the specified // host. An error will be returned if the host is not reachable from the pod. // // An empty nodeName will use the schedule to choose where the pod is executed. -func CheckConnectivityToHost(f *Framework, nodeName, podName, host string, timeout int) error { +func CheckConnectivityToHost(f *Framework, nodeName, podName, host string, pingCmd PingCommand, timeout int) error { contName := fmt.Sprintf("%s-container", podName) command := []string{ - "ping", + string(pingCmd), "-c", "3", // send 3 pings "-W", "2", // wait at most 2 seconds for a reply "-w", strconv.Itoa(timeout), diff --git a/test/e2e/network/networking.go b/test/e2e/network/networking.go index 97034485055..50b8afa84cf 100644 --- a/test/e2e/network/networking.go +++ b/test/e2e/network/networking.go @@ -45,10 +45,16 @@ var _ = SIGDescribe("Networking", func() { } }) - It("should provide Internet connection for containers", func() { + It("should provide Internet connection for containers [Feature:Networking-IPv4]", func() { By("Running container which tries to ping 8.8.8.8") framework.ExpectNoError( - framework.CheckConnectivityToHost(f, "", "ping-test", "8.8.8.8", 30)) + framework.CheckConnectivityToHost(f, "", "ping-test", "8.8.8.8", framework.IPv4PingCommand, 30)) + }) + + It("should provide Internet connection for containers [Feature:Networking-IPv6][Experimental]", func() { + By("Running container which tries to ping google.com") + framework.ExpectNoError( + framework.CheckConnectivityToHost(f, "", "ping-test", "google.com", framework.IPv6PingCommand, 30)) }) // First test because it has no dependencies on variables created later on.