Skip to content

Instantly share code, notes, and snippets.

@gavrie
Last active May 17, 2016 12:08
Show Gist options
  • Save gavrie/b8617c631d001c7dd01ef304465667a8 to your computer and use it in GitHub Desktop.
Save gavrie/b8617c631d001c7dd01ef304465667a8 to your computer and use it in GitHub Desktop.
retry unit test
package retry_test
import (
"testing"
"time"
"github.com/gavrie/retry"
)
func TestBasic(t *testing.T) {
const (
timeout = 5 * time.Second
retries = 3
)
r := retry.New(timeout, retries)
total := r.TotalTimeout()
expected := timeout * retries
if total != expected {
t.Fatalf("Unexpected total timeout."+
" Got: %v, Expected: %v", total, expected)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment