From cb9c594f98e0256f677de3e8c3f4e653fdfcf605 Mon Sep 17 00:00:00 2001 From: Claudiu Belu Date: Fri, 2 Nov 2018 13:53:37 -0700 Subject: [PATCH] tests: Separates DNS hosts entries test At the moment, Windows cannot mount individual files into Containers, which means that the Kubelet-managed hosts file cannot be mounted into the Container, causing the "should provide DNS for the cluster" test to fail. This test separates the hosts entries checks from the mentioned test to a new test. --- test/conformance/testdata/conformance.txt | 1 + test/e2e/network/dns.go | 27 ++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/test/conformance/testdata/conformance.txt b/test/conformance/testdata/conformance.txt index 6962c09d292..df60c46422a 100755 --- a/test/conformance/testdata/conformance.txt +++ b/test/conformance/testdata/conformance.txt @@ -178,6 +178,7 @@ test/e2e/kubectl/kubectl.go: "should create a job from an image, then delete the test/e2e/kubectl/kubectl.go: "should support proxy with --port 0" test/e2e/kubectl/kubectl.go: "should support --unix-socket=/path" test/e2e/network/dns.go: "should provide DNS for the cluster" +test/e2e/network/dns.go: "should provide /etc/hosts entries for the cluster" test/e2e/network/dns.go: "should provide DNS for services" test/e2e/network/proxy.go: "should proxy logs on node with explicit kubelet port using proxy subresource" test/e2e/network/proxy.go: "should proxy logs on node using proxy subresource" diff --git a/test/e2e/network/dns.go b/test/e2e/network/dns.go index 8af7177b922..03d34eb3572 100644 --- a/test/e2e/network/dns.go +++ b/test/e2e/network/dns.go @@ -39,7 +39,7 @@ var _ = SIGDescribe("DNS", func() { /* Release : v1.9 Testname: DNS, cluster - Description: When a Pod is created, the pod MUST be able to resolve cluster dns entries such as kubernetes.default via DNS and /etc/hosts. + Description: When a Pod is created, the pod MUST be able to resolve cluster dns entries such as kubernetes.default via DNS. */ framework.ConformanceIt("should provide DNS for the cluster ", func() { // All the names we need to be able to resolve. @@ -54,10 +54,8 @@ var _ = SIGDescribe("DNS", func() { namesToResolve = append(namesToResolve, "google.com") namesToResolve = append(namesToResolve, "metadata") } - hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) - hostEntries := []string{hostFQDN, dnsTestPodHostName} - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain) - jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain) + wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain) + jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain) By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") By("Running these commands on jessie: " + jessieProbeCmd + "\n") @@ -67,6 +65,25 @@ var _ = SIGDescribe("DNS", func() { validateDNSResults(f, pod, append(wheezyFileNames, jessieFileNames...)) }) + /* + Release : v1.14 + Testname: DNS, cluster + Description: When a Pod is created, the pod MUST be able to resolve cluster dns entries such as kubernetes.default via /etc/hosts. + */ + framework.ConformanceIt("should provide /etc/hosts entries for the cluster [LinuxOnly]", func() { + hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) + hostEntries := []string{hostFQDN, dnsTestPodHostName} + wheezyProbeCmd, wheezyFileNames := createProbeCommand(nil, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain) + jessieProbeCmd, jessieFileNames := createProbeCommand(nil, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain) + By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + By("Running these commands on jessie: " + jessieProbeCmd + "\n") + + // Run a pod which probes /etc/hosts and exposes the results by HTTP. + By("creating a pod to probe /etc/hosts") + pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + validateDNSResults(f, pod, append(wheezyFileNames, jessieFileNames...)) + }) + /* Release : v1.9 Testname: DNS, services