Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use e2epod.WaitForPodTerminatedInNamespace directly #89316

Merged
merged 1 commit into from Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/e2e/common/pods.go
Expand Up @@ -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))
})

/*
Expand Down
6 changes: 0 additions & 6 deletions test/e2e/framework/framework.go
Expand Up @@ -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 (
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/storage/flexvolume.go
Expand Up @@ -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)
}

Expand All @@ -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)
}

Expand Down
3 changes: 2 additions & 1 deletion test/e2e/windows/security_context.go
Expand Up @@ -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"

Expand All @@ -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]
Expand Down