Skip to content

Commit d8e348d

Browse files
committed
refactor deprecated wait.Poll functions
1 parent 139cc11 commit d8e348d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

test/e2e/audit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func expectEvents(f *framework.Framework, expectedEvents []utils.AuditEvent) {
121121
// to find all expected events. However, we're waiting for 5 minutes to avoid flakes.
122122
pollingInterval := 30 * time.Second
123123
pollingTimeout := 5 * time.Minute
124-
err := wait.Poll(pollingInterval, pollingTimeout, func() (bool, error) {
124+
err := wait.PollUntilContextTimeout(context.TODO(), pollingInterval, pollingTimeout, false, func(context.Context) (bool, error) {
125125
// Fetch the log stream.
126126
stream, err := f.ClientSet.CoreV1().RESTClient().Get().AbsPath("/logs/kube-audit.log").Stream(context.TODO())
127127
if err != nil {

test/e2e/util.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ var (
5252
pollLongTimeout = 5 * time.Minute
5353
)
5454

55-
// type ConditionFunc func() (done bool, err error)
56-
// Poll(interval, timeout time.Duration, condition ConditionFunc)
55+
// type wait.ConditionWithContextFunc func(context.Context) (done bool, err error)
56+
// PollUntilContextTimeout(ctx, interval, timeout time.Duration, immediate bool, condition wait.ConditionWithContextFunc)
5757
func waitForRouteGroup(cs rgclient.ZalandoInterface, name, ns string, d time.Duration) (string, error) {
5858
var addr string
59-
err := wait.Poll(10*time.Second, d, func() (done bool, err error) {
59+
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, d, false, func(context.Context) (done bool, err error) {
6060
rg, err := cs.ZalandoV1().RouteGroups(ns).Get(context.TODO(), name, metav1.GetOptions{ResourceVersion: "0"})
6161
if err != nil {
6262
return true, err
@@ -719,7 +719,7 @@ func waitForResponseReturnResponse(req *http.Request, timeout time.Duration, exp
719719

720720
func waitForReplicas(deploymentName, namespace string, kubeClient clientset.Interface, timeout time.Duration, desiredReplicas int) {
721721
interval := 20 * time.Second
722-
err := wait.PollImmediate(interval, timeout, func() (bool, error) {
722+
err := wait.PollUntilContextTimeout(context.TODO(), interval, timeout, true, func(context.Context) (bool, error) {
723723
deployment, err := kubeClient.AppsV1().Deployments(namespace).Get(context.TODO(), deploymentName, metav1.GetOptions{})
724724
if err != nil {
725725
framework.Failf("Failed to get replication controller %s: %v", deployment, err)

0 commit comments

Comments
 (0)