From e5eb29e41781e3e9f9fa1f38d08fa307f5f4496f Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 19 Apr 2023 07:19:26 +0000 Subject: [PATCH 1/2] Update module github.com/cenkalti/backoff/v4 to v4.2.1 --- go.mod | 2 +- go.sum | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 4692e50..cedd908 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/taskcluster/httpbackoff/v3 require ( github.com/cenkalti/backoff/v3 v3.2.2 - github.com/cenkalti/backoff/v4 v4.2.0 + github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.7.0 ) diff --git a/go.sum b/go.sum index c7ee6ee..67a31f4 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,7 @@ github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTx github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= From 68636cbcfb81e43932c63cb44e1744676319d257 Mon Sep 17 00:00:00 2001 From: Pete Moore Date: Wed, 19 Apr 2023 13:32:04 +0200 Subject: [PATCH 2/2] wip --- .taskcluster.yml | 29 +++++++++++++++++++++++++++++ .travis.yml | 32 -------------------------------- go.mod | 3 +-- go.sum | 9 +++------ httpbackoff.go | 8 ++++---- test_setup_test.go | 5 ++++- 6 files changed, 41 insertions(+), 45 deletions(-) create mode 100644 .taskcluster.yml delete mode 100644 .travis.yml diff --git a/.taskcluster.yml b/.taskcluster.yml new file mode 100644 index 0000000..9d9db79 --- /dev/null +++ b/.taskcluster.yml @@ -0,0 +1,29 @@ +version: 1 +reporting: checks-v1 +policy: + pullRequests: public +tasks: + - provisionerId: proj-taskcluster + workerType: gw-ci-ubuntu-22-04 + created: {$fromNow: ''} + deadline: {$fromNow: '1 day'} + payload: + command: + - /bin/bash + - '-vxec' + -| + git clone ${repo.clone_url} repo + cd repo + git config advice.detachedHead false + git checkout ${repo.ref} + go mod tidy + git status + # output of wc command can contain spaces on darwin, so no quotes around expression + test $(git status --porcelain | wc -l) == 0 + go test ./... + maxRunTime: 3600 + metadata: + name: httpbackoff CI + description: builds and tests httpbackoff + owner: taskcluster-internal@mozilla.com + source: ${event.repository.url} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 768ca27..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: go - -env: - - GO111MODULE=on -go: - - 1.15 - -before_install: - - go get github.com/axw/gocov/gocov - - go get github.com/mattn/goveralls - - go get golang.org/x/tools/cmd/cover - -script: - - go test -v -coverprofile=coverage.report - -after_script: - - go tool cover -func=coverage.report - - ${HOME}/gopath/bin/goveralls -coverprofile=coverage.report -service=travis-ci - -# currently cannot customise per user fork, see: -# https://github.com/travis-ci/travis-ci/issues/1094 -notifications: - irc: - channels: - - "irc.mozilla.org#taskcluster-bots" - on_success: change - on_failure: always - template: - - "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message}" - - "Change view : %{compare_url}" - - "Build details : %{build_url}" - - "Commit message : %{commit_message}" diff --git a/go.mod b/go.mod index cedd908..a179dfb 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,8 @@ module github.com/taskcluster/httpbackoff/v3 require ( - github.com/cenkalti/backoff/v3 v3.2.2 github.com/cenkalti/backoff/v4 v4.2.1 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 ) go 1.12 diff --git a/go.sum b/go.sum index 67a31f4..b7bd020 100644 --- a/go.sum +++ b/go.sum @@ -1,15 +1,12 @@ -github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTxfm6M= -github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= -github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/httpbackoff.go b/httpbackoff.go index ccf2dc9..4ec93a6 100644 --- a/httpbackoff.go +++ b/httpbackoff.go @@ -18,15 +18,15 @@ // The methods in this library should be able to run concurrently in multiple // go routines. // -// Example Usage +// # Example Usage // // Consider this trivial HTTP GET request: // -// res, err := http.Get("http://www.google.com/robots.txt") +// res, err := http.Get("http://www.google.com/robots.txt") // // This can be rewritten as follows, enabling automatic retries: // -// res, attempts, err := httpbackoff.Get("http://www.google.com/robots.txt") +// res, attempts, err := httpbackoff.Get("http://www.google.com/robots.txt") // // The variable attempts stores the number of http calls that were made (one // plus the number of retries). @@ -42,7 +42,7 @@ import ( "strconv" "time" - "github.com/cenkalti/backoff/v3" + "github.com/cenkalti/backoff/v4" ) var defaultClient Client = Client{ diff --git a/test_setup_test.go b/test_setup_test.go index f2a69e0..8c8a429 100644 --- a/test_setup_test.go +++ b/test_setup_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/cenkalti/backoff/v3" + "github.com/cenkalti/backoff/v4" ) var ( @@ -32,6 +32,9 @@ type HTTPResponse struct { // Fake auth endpoint func (this *MyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if len(this.QueuedResponses) == 0 { + return + } response := this.QueuedResponses[0] this.QueuedResponses = this.QueuedResponses[1:] w.WriteHeader(response.statusCode)