Skip to content

Commit d191660

Browse files
author
Kenichi Omichi
committed
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.
1 parent da18fd1 commit d191660

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

test/e2e/common/pods.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ var _ = framework.KubeDescribe("Pods", func() {
452452
pod.Spec.ActiveDeadlineSeconds = &newDeadline
453453
})
454454

455-
framework.ExpectNoError(f.WaitForPodTerminated(pod.Name, "DeadlineExceeded"))
455+
framework.ExpectNoError(e2epod.WaitForPodTerminatedInNamespace(f.ClientSet, pod.Name, "DeadlineExceeded", f.Namespace.Name))
456456
})
457457

458458
/*

test/e2e/framework/framework.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ import (
5353

5454
// TODO: Remove the following imports (ref: https://github.com/kubernetes/kubernetes/issues/81245)
5555
e2emetrics "k8s.io/kubernetes/test/e2e/framework/metrics"
56-
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
5756
)
5857

5958
const (
@@ -510,11 +509,6 @@ func (f *Framework) AddNamespacesToDelete(namespaces ...*v1.Namespace) {
510509
}
511510
}
512511

513-
// WaitForPodTerminated waits for the pod to be terminated with the given reason.
514-
func (f *Framework) WaitForPodTerminated(podName, reason string) error {
515-
return e2epod.WaitForPodTerminatedInNamespace(f.ClientSet, podName, reason, f.Namespace.Name)
516-
}
517-
518512
// ClientConfig an externally accessible method for reading the kube client config.
519513
func (f *Framework) ClientConfig() *rest.Config {
520514
ret := rest.CopyConfig(f.clientConfig)

test/e2e/storage/flexvolume.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ var _ = utils.SIGDescribe("Flexvolumes", func() {
193193
testFlexVolume(driverInstallAs, config, f)
194194

195195
ginkgo.By("waiting for flex client pod to terminate")
196-
if err := f.WaitForPodTerminated(config.Prefix+"-client", ""); !apierrors.IsNotFound(err) {
196+
if err := e2epod.WaitForPodTerminatedInNamespace(f.ClientSet, config.Prefix+"-client", "", f.Namespace.Name); !apierrors.IsNotFound(err) {
197197
framework.ExpectNoError(err, "Failed to wait client pod terminated: %v", err)
198198
}
199199

@@ -213,7 +213,7 @@ var _ = utils.SIGDescribe("Flexvolumes", func() {
213213
testFlexVolume(driverInstallAs, config, f)
214214

215215
ginkgo.By("waiting for flex client pod to terminate")
216-
if err := f.WaitForPodTerminated(config.Prefix+"-client", ""); !apierrors.IsNotFound(err) {
216+
if err := e2epod.WaitForPodTerminatedInNamespace(f.ClientSet, config.Prefix+"-client", "", f.Namespace.Name); !apierrors.IsNotFound(err) {
217217
framework.ExpectNoError(err, "Failed to wait client pod terminated: %v", err)
218218
}
219219

test/e2e/windows/security_context.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2323
"k8s.io/apimachinery/pkg/util/uuid"
2424
"k8s.io/kubernetes/test/e2e/framework"
25+
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
2526
testutils "k8s.io/kubernetes/test/utils"
2627
imageutils "k8s.io/kubernetes/test/utils/image"
2728

@@ -47,7 +48,7 @@ var _ = SIGDescribe("[Feature:Windows] SecurityContext RunAsUserName", func() {
4748
podInvalid := f.PodClient().Create(runAsUserNamePod(toPtr("FooLish")))
4849

4950
framework.Logf("Waiting for pod %s to enter the error state.", podInvalid.Name)
50-
framework.ExpectNoError(f.WaitForPodTerminated(podInvalid.Name, ""))
51+
framework.ExpectNoError(e2epod.WaitForPodTerminatedInNamespace(f.ClientSet, podInvalid.Name, "", f.Namespace.Name))
5152

5253
podInvalid, _ = f.PodClient().Get(context.TODO(), podInvalid.Name, metav1.GetOptions{})
5354
podTerminatedReason := testutils.TerminatedContainers(podInvalid)[runAsUserNameContainerName]

0 commit comments

Comments
 (0)