Skip to content

Commit 5285cf3

Browse files
author
Kenichi Omichi
committed
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.
1 parent 54a3070 commit 5285cf3

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

test/e2e/framework/pod/resource.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -442,17 +442,6 @@ func NewExecPodSpec(ns, name string, hostNetwork bool) *v1.Pod {
442442
return pod
443443
}
444444

445-
// LaunchHostExecPod launches a hostexec pod in the given namespace and waits
446-
// until it's Running
447-
func LaunchHostExecPod(client clientset.Interface, ns, name string) *v1.Pod {
448-
hostExecPod := NewExecPodSpec(ns, name, true)
449-
pod, err := client.CoreV1().Pods(ns).Create(hostExecPod)
450-
expectNoError(err)
451-
err = WaitForPodRunningInNamespace(client, pod)
452-
expectNoError(err)
453-
return pod
454-
}
455-
456445
// newExecPodSpec returns the pod spec of exec pod
457446
func newExecPodSpec(ns, generateName string) *v1.Pod {
458447
immediate := int64(0)

test/e2e/network/service.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ var _ = SIGDescribe("Services", func() {
13101310
err = t.DeleteService(serviceName)
13111311
framework.ExpectNoError(err, "failed to delete service: %s in namespace: %s", serviceName, ns)
13121312

1313-
hostExec := e2epod.LaunchHostExecPod(f.ClientSet, f.Namespace.Name, "hostexec")
1313+
hostExec := launchHostExecPod(f.ClientSet, f.Namespace.Name, "hostexec")
13141314
cmd := fmt.Sprintf(`! ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN`, nodePort)
13151315
var stdout string
13161316
if pollErr := wait.PollImmediate(framework.Poll, e2eservice.KubeProxyLagTimeout, func() (bool, error) {
@@ -1610,7 +1610,7 @@ var _ = SIGDescribe("Services", func() {
16101610
// a pod to test the service.
16111611
ginkgo.By("hitting the internal load balancer from pod")
16121612
framework.Logf("creating pod with host network")
1613-
hostExec := e2epod.LaunchHostExecPod(f.ClientSet, f.Namespace.Name, "ilb-host-exec")
1613+
hostExec := launchHostExecPod(f.ClientSet, f.Namespace.Name, "ilb-host-exec")
16141614

16151615
framework.Logf("Waiting up to %v for service %q's internal LB to respond to requests", createTimeout, serviceName)
16161616
tcpIngressIP := e2eservice.GetIngressPoint(lbIngress)
@@ -2545,3 +2545,14 @@ func createPausePodDeployment(cs clientset.Interface, name, ns string, replicas
25452545
framework.ExpectNoError(err, "Error in creating deployment for pause pod")
25462546
return deployment
25472547
}
2548+
2549+
// launchHostExecPod launches a hostexec pod in the given namespace and waits
2550+
// until it's Running
2551+
func launchHostExecPod(client clientset.Interface, ns, name string) *v1.Pod {
2552+
hostExecPod := e2epod.NewExecPodSpec(ns, name, true)
2553+
pod, err := client.CoreV1().Pods(ns).Create(hostExecPod)
2554+
framework.ExpectNoError(err)
2555+
err = e2epod.WaitForPodRunningInNamespace(client, pod)
2556+
framework.ExpectNoError(err)
2557+
return pod
2558+
}

0 commit comments

Comments
 (0)