Skip to content

Commit

Permalink
fix: replace deprecated function
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Vasek <[email protected]>
  • Loading branch information
matejvasek committed Oct 18, 2023
1 parent 788f18c commit 46543a7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/common/readycheck.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package common

import (
"context"
"testing"
"time"

"k8s.io/apimachinery/pkg/util/wait"
)

func WaitForFunctionReady(t *testing.T, functionName string) (revisionName string, functionUrl string) {
err := wait.PollImmediate(5*time.Second, 1*time.Minute, func() (done bool, err error) {
err := wait.PollUntilContextTimeout(context.Background(), 5*time.Second, 1*time.Minute, true, func(_ context.Context) (done bool, err error) {
revisionName, functionUrl = GetKnativeServiceRevisionAndUrl(t, functionName)
t.Logf("Waiting function to get ready (revision [%v])", revisionName)
return revisionName != "", nil
Expand All @@ -21,7 +22,7 @@ func WaitForFunctionReady(t *testing.T, functionName string) (revisionName strin

// NewRevisionCheck waits for a new revision to report as ready
func WaitForNewRevisionReady(t *testing.T, previousRevision string, functionName string) (newRevision string) {
err := wait.PollImmediate(5*time.Second, 1*time.Minute, func() (done bool, err error) {
err := wait.PollUntilContextTimeout(context.Background(), 5*time.Second, 1*time.Minute, true, func(_ context.Context) (done bool, err error) {
newRevision = GetCurrentServiceRevision(t, functionName)
t.Logf("Waiting for new revision deployment (previous revision [%v], current revision [%v])", previousRevision, newRevision)
return newRevision != "" && newRevision != previousRevision, nil
Expand Down

0 comments on commit 46543a7

Please sign in to comment.