From d191660c254822b0224345ffa4daaf992af68a26 Mon Sep 17 00:00:00 2001 From: Kenichi Omichi Date: Fri, 20 Mar 2020 20:27:09 +0000 Subject: [PATCH] Use e2epod.WaitForPodTerminatedInNamespace directly WaitForPod*() are just wrapper functions for e2epod package, and they made an invalid dependency to sub e2e framework from the core framework. So this replaces WaitForPodTerminated() with the e2epod function. --- test/e2e/common/pods.go | 2 +- test/e2e/framework/framework.go | 6 ------ test/e2e/storage/flexvolume.go | 4 ++-- test/e2e/windows/security_context.go | 3 ++- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/test/e2e/common/pods.go b/test/e2e/common/pods.go index 66bf63ff43f..2b1a070647b 100644 --- a/test/e2e/common/pods.go +++ b/test/e2e/common/pods.go @@ -452,7 +452,7 @@ var _ = framework.KubeDescribe("Pods", func() { pod.Spec.ActiveDeadlineSeconds = &newDeadline }) - framework.ExpectNoError(f.WaitForPodTerminated(pod.Name, "DeadlineExceeded")) + framework.ExpectNoError(e2epod.WaitForPodTerminatedInNamespace(f.ClientSet, pod.Name, "DeadlineExceeded", f.Namespace.Name)) }) /* diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index c34d5c30ee5..794ec2a2395 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -53,7 +53,6 @@ import ( // TODO: Remove the following imports (ref: https://github.com/kubernetes/kubernetes/issues/81245) e2emetrics "k8s.io/kubernetes/test/e2e/framework/metrics" - e2epod "k8s.io/kubernetes/test/e2e/framework/pod" ) const ( @@ -510,11 +509,6 @@ func (f *Framework) AddNamespacesToDelete(namespaces ...*v1.Namespace) { } } -// WaitForPodTerminated waits for the pod to be terminated with the given reason. -func (f *Framework) WaitForPodTerminated(podName, reason string) error { - return e2epod.WaitForPodTerminatedInNamespace(f.ClientSet, podName, reason, f.Namespace.Name) -} - // ClientConfig an externally accessible method for reading the kube client config. func (f *Framework) ClientConfig() *rest.Config { ret := rest.CopyConfig(f.clientConfig) diff --git a/test/e2e/storage/flexvolume.go b/test/e2e/storage/flexvolume.go index 76a33aebfd1..2cf7bdf002d 100644 --- a/test/e2e/storage/flexvolume.go +++ b/test/e2e/storage/flexvolume.go @@ -193,7 +193,7 @@ var _ = utils.SIGDescribe("Flexvolumes", func() { testFlexVolume(driverInstallAs, config, f) ginkgo.By("waiting for flex client pod to terminate") - if err := f.WaitForPodTerminated(config.Prefix+"-client", ""); !apierrors.IsNotFound(err) { + if err := e2epod.WaitForPodTerminatedInNamespace(f.ClientSet, config.Prefix+"-client", "", f.Namespace.Name); !apierrors.IsNotFound(err) { framework.ExpectNoError(err, "Failed to wait client pod terminated: %v", err) } @@ -213,7 +213,7 @@ var _ = utils.SIGDescribe("Flexvolumes", func() { testFlexVolume(driverInstallAs, config, f) ginkgo.By("waiting for flex client pod to terminate") - if err := f.WaitForPodTerminated(config.Prefix+"-client", ""); !apierrors.IsNotFound(err) { + if err := e2epod.WaitForPodTerminatedInNamespace(f.ClientSet, config.Prefix+"-client", "", f.Namespace.Name); !apierrors.IsNotFound(err) { framework.ExpectNoError(err, "Failed to wait client pod terminated: %v", err) } diff --git a/test/e2e/windows/security_context.go b/test/e2e/windows/security_context.go index ca9166a5e81..ff100d7ba20 100644 --- a/test/e2e/windows/security_context.go +++ b/test/e2e/windows/security_context.go @@ -22,6 +22,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/uuid" "k8s.io/kubernetes/test/e2e/framework" + e2epod "k8s.io/kubernetes/test/e2e/framework/pod" testutils "k8s.io/kubernetes/test/utils" imageutils "k8s.io/kubernetes/test/utils/image" @@ -47,7 +48,7 @@ var _ = SIGDescribe("[Feature:Windows] SecurityContext RunAsUserName", func() { podInvalid := f.PodClient().Create(runAsUserNamePod(toPtr("FooLish"))) framework.Logf("Waiting for pod %s to enter the error state.", podInvalid.Name) - framework.ExpectNoError(f.WaitForPodTerminated(podInvalid.Name, "")) + framework.ExpectNoError(e2epod.WaitForPodTerminatedInNamespace(f.ClientSet, podInvalid.Name, "", f.Namespace.Name)) podInvalid, _ = f.PodClient().Get(context.TODO(), podInvalid.Name, metav1.GetOptions{}) podTerminatedReason := testutils.TerminatedContainers(podInvalid)[runAsUserNameContainerName]