diff --git a/test/e2e/framework/test_context.go b/test/e2e/framework/test_context.go index 7757635968f..46d6a0444d5 100644 --- a/test/e2e/framework/test_context.go +++ b/test/e2e/framework/test_context.go @@ -234,6 +234,11 @@ type CloudConfig struct { // TestContext should be used by all tests to access common context data. var TestContext TestContextType +// ClusterIsIPv6 returns true if the cluster is IPv6 +func (tc TestContextType) ClusterIsIPv6() bool { + return tc.IPFamily == "ipv6" +} + // RegisterCommonFlags registers flags common to all e2e test suites. // The flag set can be flag.CommandLine (if desired) or a custom // flag set that then gets passed to viperconfig.ViperizeFlags. diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index daf25b8f27b..6caf80c2e55 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -430,11 +430,6 @@ func getDefaultClusterIPFamily(c clientset.Interface) string { return "ipv4" } -// ClusterIsIPv6 returns true if the cluster is IPv6 -func ClusterIsIPv6() bool { - return TestContext.IPFamily == "ipv6" -} - // ProviderIs returns true if the provider is included is the providers. Otherwise false. func ProviderIs(providers ...string) bool { for _, provider := range providers { diff --git a/test/e2e/network/dns.go b/test/e2e/network/dns.go index 0fe340c7d72..d7e92373f67 100644 --- a/test/e2e/network/dns.go +++ b/test/e2e/network/dns.go @@ -50,8 +50,8 @@ var _ = SIGDescribe("DNS", func() { fmt.Sprintf("kubernetes.default.svc.%s", framework.TestContext.ClusterDNSDomain), } // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) + wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") @@ -72,8 +72,8 @@ var _ = SIGDescribe("DNS", func() { } // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) + wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") @@ -94,8 +94,8 @@ var _ = SIGDescribe("DNS", func() { hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostEntries := []string{hostFQDN, dnsTestPodHostName} // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) + wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") @@ -114,8 +114,8 @@ var _ = SIGDescribe("DNS", func() { hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostEntries := []string{hostFQDN, dnsTestPodHostName} // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(nil, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(nil, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) + wheezyProbeCmd, wheezyFileNames := createProbeCommand(nil, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(nil, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") @@ -167,8 +167,8 @@ var _ = SIGDescribe("DNS", func() { } // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) + wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") @@ -218,8 +218,8 @@ var _ = SIGDescribe("DNS", func() { } // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) + wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") @@ -258,8 +258,8 @@ var _ = SIGDescribe("DNS", func() { hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", podHostname, serviceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostNames := []string{hostFQDN, podHostname} // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(nil, hostNames, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(nil, hostNames, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) + wheezyProbeCmd, wheezyFileNames := createProbeCommand(nil, hostNames, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(nil, hostNames, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") @@ -301,8 +301,8 @@ var _ = SIGDescribe("DNS", func() { subdomain := fmt.Sprintf("%s.%s.svc.%s", serviceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) namesToResolve := []string{hostFQDN, subdomain} // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6()) + wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") @@ -374,7 +374,7 @@ var _ = SIGDescribe("DNS", func() { }) framework.ExpectNoError(err, "failed to change service type to ClusterIP for service: %s", serviceName) targetRecord := "A" - if framework.ClusterIsIPv6() { + if framework.TestContext.ClusterIsIPv6() { targetRecord = "AAAA" } // TODO: For dual stack we can run from here two createTargetedProbeCommand()