Skip to content

Commit

Permalink
add backoff handling to SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
czeslavo committed Dec 23, 2024
1 parent 02be60a commit f1deb7e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test/internal/helpers/konnect/control_plane.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (
"testing"
"time"

"github.com/avast/retry-go/v4"
sdkkonnectgo "github.com/Kong/sdk-konnect-go"
"github.com/Kong/sdk-konnect-go/retry"
"github.com/google/uuid"
"github.com/samber/lo"
"github.com/stretchr/testify/assert"
Expand All @@ -30,7 +31,16 @@ import (
func CreateTestControlPlane(ctx context.Context, t *testing.T) string {
t.Helper()

sdk := sdk.New(accessToken(), serverURLOpt())
sdk := sdk.New(accessToken(), serverURLOpt(),
sdkkonnectgo.WithRetryConfig(retry.Config{
Backoff: &retry.BackoffStrategy{
InitialInterval: 100,
MaxInterval: 2000,
Exponent: 1.2,
MaxElapsedTime: 10000,
},
}),
)

var cpID string
createRgErr := retry.Do(func() error {

Check failure on line 46 in test/internal/helpers/konnect/control_plane.go

View workflow job for this annotation

GitHub Actions / kongintegration-tests / oss

undefined: retry.Do

Check failure on line 46 in test/internal/helpers/konnect/control_plane.go

View workflow job for this annotation

GitHub Actions / kongintegration-tests / oss

undefined: retry.Do

Check failure on line 46 in test/internal/helpers/konnect/control_plane.go

View workflow job for this annotation

GitHub Actions / kongintegration-tests / enterprise

undefined: retry.Do

Check failure on line 46 in test/internal/helpers/konnect/control_plane.go

View workflow job for this annotation

GitHub Actions / kongintegration-tests / enterprise

undefined: retry.Do

Check failure on line 46 in test/internal/helpers/konnect/control_plane.go

View workflow job for this annotation

GitHub Actions / linters / lint

undefined: retry.Do

Check failure on line 46 in test/internal/helpers/konnect/control_plane.go

View workflow job for this annotation

GitHub Actions / linters / lint

undefined: retry.Do
Expand Down

0 comments on commit f1deb7e

Please sign in to comment.