Skip to content

Commit

Permalink
Clean up needless helper function, add succinct regression refs
Browse files Browse the repository at this point in the history
  • Loading branch information
flowchartsman committed Dec 16, 2020
1 parent 8a0d573 commit 7b4b1f8
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions retry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,13 @@ func ExampleRetrier_RunContext_output() {
// Output: Get "http://golang.org/notfastenough": context deadline exceeded
}

func backoffPanicCheck(t *testing.T) {
r := recover()
if r != nil {
t.Errorf("expected no panic, got panic %v", r)
}
}

// This test validates that the panic reported in https://github.com/flowchartsman/retry/issues/4 has been fixed
// Ref: https://github.com/flowchartsman/retry/issues/4
func TestBackoffPanicFix(t *testing.T) {
defer backoffPanicCheck(t)
defer func() {
if r := recover(); r != nil {
t.Error("Backoff underflows and panics")
}
}()

initialDelay := 500 * time.Millisecond
maxDelay := 1 * time.Millisecond
Expand All @@ -263,6 +260,7 @@ func TestBackoffPanicFix(t *testing.T) {
}
}

// Ref: https://github.com/flowchartsman/retry/issues/7
func TestZeroValueRetrierDoesNotPanic(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode.")
Expand Down

0 comments on commit 7b4b1f8

Please sign in to comment.