From 5285cf3eb2f91d008bc203af3a40d4b55a022946 Mon Sep 17 00:00:00 2001 From: Kenichi Omichi Date: Fri, 18 Oct 2019 17:29:01 +0000 Subject: [PATCH] Move LaunchHostExecPod() to e2e network LaunchHostExecPod() is called only from e2e network. So it is not necessary to keep the function as a part of e2e framework. This moves it to the place which calls the function. --- test/e2e/framework/pod/resource.go | 11 ----------- test/e2e/network/service.go | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/test/e2e/framework/pod/resource.go b/test/e2e/framework/pod/resource.go index 9c9bc5013c0..3d007ec0a4f 100644 --- a/test/e2e/framework/pod/resource.go +++ b/test/e2e/framework/pod/resource.go @@ -442,17 +442,6 @@ func NewExecPodSpec(ns, name string, hostNetwork bool) *v1.Pod { return pod } -// LaunchHostExecPod launches a hostexec pod in the given namespace and waits -// until it's Running -func LaunchHostExecPod(client clientset.Interface, ns, name string) *v1.Pod { - hostExecPod := NewExecPodSpec(ns, name, true) - pod, err := client.CoreV1().Pods(ns).Create(hostExecPod) - expectNoError(err) - err = WaitForPodRunningInNamespace(client, pod) - expectNoError(err) - return pod -} - // newExecPodSpec returns the pod spec of exec pod func newExecPodSpec(ns, generateName string) *v1.Pod { immediate := int64(0) diff --git a/test/e2e/network/service.go b/test/e2e/network/service.go index 2272febe808..fef102dd9be 100644 --- a/test/e2e/network/service.go +++ b/test/e2e/network/service.go @@ -1310,7 +1310,7 @@ var _ = SIGDescribe("Services", func() { err = t.DeleteService(serviceName) framework.ExpectNoError(err, "failed to delete service: %s in namespace: %s", serviceName, ns) - hostExec := e2epod.LaunchHostExecPod(f.ClientSet, f.Namespace.Name, "hostexec") + hostExec := launchHostExecPod(f.ClientSet, f.Namespace.Name, "hostexec") cmd := fmt.Sprintf(`! ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN`, nodePort) var stdout string if pollErr := wait.PollImmediate(framework.Poll, e2eservice.KubeProxyLagTimeout, func() (bool, error) { @@ -1610,7 +1610,7 @@ var _ = SIGDescribe("Services", func() { // a pod to test the service. ginkgo.By("hitting the internal load balancer from pod") framework.Logf("creating pod with host network") - hostExec := e2epod.LaunchHostExecPod(f.ClientSet, f.Namespace.Name, "ilb-host-exec") + hostExec := launchHostExecPod(f.ClientSet, f.Namespace.Name, "ilb-host-exec") framework.Logf("Waiting up to %v for service %q's internal LB to respond to requests", createTimeout, serviceName) tcpIngressIP := e2eservice.GetIngressPoint(lbIngress) @@ -2545,3 +2545,14 @@ func createPausePodDeployment(cs clientset.Interface, name, ns string, replicas framework.ExpectNoError(err, "Error in creating deployment for pause pod") return deployment } + +// launchHostExecPod launches a hostexec pod in the given namespace and waits +// until it's Running +func launchHostExecPod(client clientset.Interface, ns, name string) *v1.Pod { + hostExecPod := e2epod.NewExecPodSpec(ns, name, true) + pod, err := client.CoreV1().Pods(ns).Create(hostExecPod) + framework.ExpectNoError(err) + err = e2epod.WaitForPodRunningInNamespace(client, pod) + framework.ExpectNoError(err) + return pod +}