fix a bug in test

This commit is contained in:
iamqizhao
2015-10-21 15:21:58 -07:00
parent 0142d18c83
commit e18e2c8054

View File

@ -1063,11 +1063,12 @@ func testExceedMaxStreamsLimit(t *testing.T, e env) {
done := make(chan struct{}) done := make(chan struct{})
ch := make(chan int) ch := make(chan int)
go func() { go func() {
timer := time.After(5 * time.Second)
for { for {
select { select {
case <-time.After(5 * time.Millisecond): case <-time.After(5 * time.Millisecond):
ch <- 0 ch <- 0
case <-time.After(5 * time.Second): case <-timer:
close(done) close(done)
return return
} }
@ -1077,6 +1078,7 @@ func testExceedMaxStreamsLimit(t *testing.T, e env) {
for { for {
select { select {
case <-ch: case <-ch:
//grpclog.Println("start a stream...")
ctx, _ := context.WithTimeout(context.Background(), time.Second) ctx, _ := context.WithTimeout(context.Background(), time.Second)
if _, err := tc.StreamingInputCall(ctx); err != nil { if _, err := tc.StreamingInputCall(ctx); err != nil {
if grpc.Code(err) == codes.DeadlineExceeded { if grpc.Code(err) == codes.DeadlineExceeded {