rpc/stream/proxy: fix a flaky test
This change fixes a flaky test which can happen when a idle timer starts
before a server accepts a flow in a very heavy load.
Change-Id: Ib98619c4a485becce318c5a9295373e174fd3a46
diff --git a/runtime/internal/rpc/stream/proxy/proxy_test.go b/runtime/internal/rpc/stream/proxy/proxy_test.go
index c325e13..a438489 100644
--- a/runtime/internal/rpc/stream/proxy/proxy_test.go
+++ b/runtime/internal/rpc/stream/proxy/proxy_test.go
@@ -385,13 +385,6 @@
t.Fatal(err)
}
defer ln.Close()
- go func() {
- for {
- if _, err := ln.Accept(); err != nil {
- return
- }
- }
- }()
// Create the stream.Manager for a client.
client := manager.InternalNew(naming.FixedRoutingID(0xcccccccccccccccc))
@@ -406,6 +399,9 @@
if err != nil {
t.Fatal(err)
}
+ if _, err = ln.Accept(); err != nil {
+ t.Fatal(err)
+ }
// Trigger the idle timers.
triggerTimers()
@@ -418,7 +414,7 @@
// There is one active flow. The VC should be kept open.
time.Sleep(waitTime)
if numProcs := proxy.NumProcesses(Proxy); numProcs != 2 {
- t.Errorf("Want VC is kept open; closed")
+ t.Errorf("Want VC is kept open, but closed: number of processes: %d", numProcs)
}
flow.Close()