e2e tests need a ping6 test for IPv6-only clusters

e2e tests provide only an (IPv4) ping test for external connectivity.

We need a way to conditionally run a ping6 external connectivity check,
and disable the (IPv4) ping-based external connectivity check,
for end-to-end testing on IPv6-only clusters.

This feature will be needed for creating gating IPv6 CI tests.

fixes #53383
This commit is contained in:
Dane LeBlanc
2017-10-03 10:46:27 -04:00
parent 41568a0602
commit 4be181739e
2 changed files with 17 additions and 4 deletions

View File

@@ -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),

View File

@@ -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.