Skip to content

Commit

Permalink
Merge pull request #1598 from armsnyder/fix-slow-tests
Browse files Browse the repository at this point in the history
Fix slow tests caused by retry backoff
  • Loading branch information
svanharmelen committed Dec 12, 2022
2 parents b56a655 + 21ae872 commit 52eedaa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gitlab_test.go
Expand Up @@ -27,6 +27,7 @@ import (
"os"
"strings"
"testing"
"time"

retryablehttp "github.com/hashicorp/go-retryablehttp"
)
Expand All @@ -45,7 +46,13 @@ func setup(t *testing.T) (*http.ServeMux, *Client) {
t.Cleanup(server.Close)

// client is the Gitlab client being tested.
client, err := NewClient("", WithBaseURL(server.URL))
client, err := NewClient("",
WithBaseURL(server.URL),
// Disable backoff to speed up tests that expect errors.
WithCustomBackoff(func(_, _ time.Duration, _ int, _ *http.Response) time.Duration {
return 0
}),
)
if err != nil {
t.Fatalf("Failed to create client: %v", err)
}
Expand Down

0 comments on commit 52eedaa

Please sign in to comment.