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

Update HTTPCheck step in function tests #10043

Merged
merged 1 commit into from Nov 25, 2020
Merged
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
22 changes: 21 additions & 1 deletion tests/function-controller/testsuite/teststep/check.go
Expand Up @@ -3,9 +3,12 @@ package teststep
import (
"fmt"
"net/url"
"time"

"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/util/retry"

"github.com/kyma-project/kyma/tests/function-controller/pkg/function"
"github.com/kyma-project/kyma/tests/function-controller/pkg/poller"
Expand Down Expand Up @@ -39,7 +42,24 @@ func (h HTTPCheck) Name() string {
}

func (h HTTPCheck) Run() error {
return errors.Wrap(h.poll.PollForAnswer(h.endpoint, "", h.expectedMsg), "while checking function through the gateway")
// backoff is needed because even tough the deployment may be ready
// the language specific server may not start yet
// there may also be some problems with istio sidecars etc
backoff := wait.Backoff{
Steps: 5,
Duration: 100 * time.Millisecond,
Factor: 2.0,
Jitter: 0.1,
}
return retry.OnError(backoff, func(err error) bool {
return true
}, func() error {
err := errors.Wrap(h.poll.PollForAnswer(h.endpoint, "", h.expectedMsg), "while checking connection to function")
if err != nil {
h.log.Warnf("while checking connection to %s, err: %s", h.endpoint, err)
}
return err
})
}

func (h HTTPCheck) Cleanup() error {
Expand Down