Skip to content

Commit

Permalink
Merge pull request #7 from l3uddz/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
l3uddz authored Feb 22, 2020
2 parents ed029f7 + ed219c2 commit 9bc04ea
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test-all: test lint
.PHONY: test
test: ## Run tests
@echo "*** go test ***"
go test -cover -mod vendor -v -race ${GO_PACKAGES}
go test -cover -v -race ${GO_PACKAGES}

.PHONY: lint
lint: check_golangci ## Run linting
Expand Down
6 changes: 3 additions & 3 deletions pvr/pvr.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ var (
pvrDefaultPageSize = 1000
pvrDefaultTimeout = 120
pvrDefaultRetry = web.Retry{
MaxAttempts: 5,
MaxAttempts: 6,
RetryableStatusCodes: []int{
504,
},
Backoff: backoff.Backoff{
Jitter: true,
Min: 1 * time.Second,
Max: 5 * time.Second,
Min: 500 * time.Millisecond,
Max: 10 * time.Second,
},
}
)
Expand Down
20 changes: 20 additions & 0 deletions utils/web/request_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package web

import (
"os"
"testing"
)

/* Test Get Response Timeout */

func TestGetResponseTimeout(t *testing.T) {
// send request
resp, err := GetResponse(GET, "https://httpbin.davecheney.com/delay/5", 3)
if err != nil && !os.IsTimeout(err) {
t.Errorf("Expected timeout in 3 seconds but got error: %v", err)
return
} else if err == nil {
defer resp.Response().Body.Close()
t.Errorf("Expected timeout in 3 seconds but got no error...")
}
}

0 comments on commit 9bc04ea

Please sign in to comment.