From d7e47cfb1917d7c7848b989412d5aa8df578f4c6 Mon Sep 17 00:00:00 2001 From: Javier Diaz-Montes Date: Fri, 6 Nov 2020 07:33:50 -0500 Subject: [PATCH] Fixing expected pod subdomain to match framework.TestContext.ClusterDNSDomain --- test/e2e_node/pod_hostnamefqdn_test.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/test/e2e_node/pod_hostnamefqdn_test.go b/test/e2e_node/pod_hostnamefqdn_test.go index bc170441cb9..b1f8ef8d3ba 100644 --- a/test/e2e_node/pod_hostnamefqdn_test.go +++ b/test/e2e_node/pod_hostnamefqdn_test.go @@ -71,11 +71,6 @@ func testPod(podnamebase string) *v1.Pod { var _ = SIGDescribe("Hostname of Pod [Feature:SetHostnameAsFQDN][NodeFeature:SetHostnameAsFQDN]", func() { f := framework.NewDefaultFramework("hostfqdn") - dnsDomain := "cluster.local" - if cdn := framework.TestContext.ClusterDNSDomain; cdn != "" { - dnsDomain = cdn - } - /* Release: v1.19 Testname: Create Pod without fully qualified domain name (FQDN) @@ -119,7 +114,7 @@ var _ = SIGDescribe("Hostname of Pod [Feature:SetHostnameAsFQDN][NodeFeature:Set // Set PodSpec subdomain field to generate FQDN for pod pod.Spec.Subdomain = subdomain // Expected Pod FQDN - hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", pod.ObjectMeta.Name, subdomain, f.Namespace.Name, dnsDomain) + hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", pod.ObjectMeta.Name, subdomain, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) output := []string{fmt.Sprintf("%s;%s;", pod.ObjectMeta.Name, hostFQDN)} // Create Pod f.TestContainerOutput("shortname and fqdn", pod, 0, output) @@ -141,7 +136,7 @@ var _ = SIGDescribe("Hostname of Pod [Feature:SetHostnameAsFQDN][NodeFeature:Set setHostnameAsFQDN := true pod.Spec.SetHostnameAsFQDN = &setHostnameAsFQDN // Expected Pod FQDN - hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", pod.ObjectMeta.Name, subdomain, f.Namespace.Name, dnsDomain) + hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", pod.ObjectMeta.Name, subdomain, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) // Fail if FQDN is longer than 64 characters, otherwise the Pod will remain pending until test timeout. // In Linux, 64 characters is the limit of the hostname kernel field, which this test sets to the pod FQDN. framework.ExpectEqual(len(hostFQDN) < 65, true, fmt.Sprintf("The FQDN of the Pod cannot be longer than 64 characters, requested %s which is %d characters long.", hostFQDN, len(hostFQDN)))