rafthttp: fix TestPipelineExceedMaximumServing

The timeout is too short. It might take more than 10ms to send
request over a blocking chan (buffer is full). Changing the timeout
to 1 second can fix this issue.
This commit is contained in:
Xiang Li 2016-09-13 18:45:48 +08:00
parent cfe717e926
commit 0d35ba9b94

View File

@ -67,9 +67,9 @@ func TestPipelineKeepSendingWhenPostError(t *testing.T) {
}
func TestPipelineExceedMaximumServing(t *testing.T) {
tr := newRoundTripperBlocker()
rt := newRoundTripperBlocker()
picker := mustNewURLPicker(t, []string{"http://localhost:2380"})
tp := &Transport{pipelineRt: tr}
tp := &Transport{pipelineRt: rt}
p := startTestPipeline(tp, picker)
defer p.stop()
@ -91,12 +91,12 @@ func TestPipelineExceedMaximumServing(t *testing.T) {
}
// unblock the senders and force them to send out the data
tr.unblock()
rt.unblock()
// It could send new data after previous ones succeed
select {
case p.msgc <- raftpb.Message{}:
case <-time.After(10 * time.Millisecond):
case <-time.After(time.Second):
t.Errorf("failed to send out message")
}
}