From 4179d89d537b8c451d5ebf00d52ae69986a77c93 Mon Sep 17 00:00:00 2001 From: iamqizhao Date: Wed, 29 Jul 2015 11:15:58 -0700 Subject: [PATCH] polish the newly added transport test --- transport/transport_test.go | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/transport/transport_test.go b/transport/transport_test.go index 20893519..0a347319 100644 --- a/transport/transport_test.go +++ b/transport/transport_test.go @@ -408,22 +408,14 @@ func TestMaxStreams(t *testing.T) { } // Close the pending stream so that the streams quota becomes available for the next new stream. ct.CloseStream(s, nil) - for { - select { - case <-ch: - case <-done: - t.Fatalf("Client has not received the max stream setting in 5 seconds.") + select { + case i:=<-cc.streamsQuota.acquire(): + if i != 1 { + t.Fatalf("streamsQuota.acquire() got %d quota, want 1.", i) } - select { - case i:=<-cc.streamsQuota.acquire(): - if i != 1 { - t.Fatalf("fadfa") - } - cc.streamsQuota.add(i) - default: - t.Fatalf("43092") - } - break + cc.streamsQuota.add(i) + default: + t.Fatalf("streamsQuota.acquire() is not readable.") } if _, err := ct.NewStream(context.Background(), callHdr); err != nil { t.Fatalf("failed to open stream: %v", err)