Skip to content

Commit

Permalink
retry of 1 should retry once and run twice
Browse files Browse the repository at this point in the history
  • Loading branch information
xchapter7x committed Nov 7, 2018
1 parent 514b93f commit a47dfce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fetch/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func Fetch(envkey string, options FetchOptions) (string, error) {
fmt.Fprintln(os.Stderr, err)
}

if options.Retry > 1 {
if options.Retry > 0 {
options.Retry--
return Fetch(envkey, options)
}
Expand Down
2 changes: 1 addition & 1 deletion fetch/fetch_test/fetch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func TestFetch(t *testing.T) {

fetch.Fetch(test.envkey, opts)
if test.expectErr && test.responseStatus != http.StatusNotFound {
assert.Equal(retry, callCount, test.desc+" should retry")
assert.Equal(retry+1, callCount, test.desc+" should retry")
} else {
assert.Equal(1, callCount, test.desc+" should not retry")
}
Expand Down

0 comments on commit a47dfce

Please sign in to comment.