add too many retries test case

This commit is contained in:
Barak Michener 2014-10-08 21:58:19 -04:00
parent 9b35ca3a52
commit 5fde52a403

View File

@ -108,7 +108,7 @@ func TestCheckCluster(t *testing.T) {
c := &clientWithResp{rs: rs}
d := discovery{cluster: cluster, id: 1, c: c}
cRetry := &clientWithRetry{failTimes: 2}
cRetry := &clientWithRetry{failTimes: 3}
cRetry.rs = rs
dRetry := discovery{cluster: cluster, id: 1, c: cRetry, timeoutTimescale: time.Millisecond * 2}
@ -294,6 +294,16 @@ func TestSortableNodes(t *testing.T) {
}
}
func TestRetryFailure(t *testing.T) {
cluster := "1000"
c := &clientWithRetry{failTimes: 4}
d := discovery{cluster: cluster, id: 1, c: c, timeoutTimescale: time.Millisecond * 2}
_, _, err := d.checkCluster()
if err != ErrTooManyRetries {
t.Errorf("err = %v, want %v", err, ErrTooManyRetries)
}
}
type clientWithResp struct {
rs []*client.Response
w client.Watcher