2
0
mirror of https://github.com/soheilhy/cmux.git synced 2024-11-10 03:31:52 +08:00

fix flaky test TestErrorHandler

Before this change, this test would fail after about 50 runs. After
this change, I was able to run it 200 times without failure.
This commit is contained in:
Tamir Duberstein 2016-02-23 10:57:48 -05:00
parent 95fd8b5c56
commit 9a9119af9d

View File

@ -227,12 +227,11 @@ func TestErrorHandler(t *testing.T) {
defer cleanup()
var num int
if err := c.Call("TestRPCRcvr.Test", rpcVal, &num); err == nil {
// The connection is simply closed.
t.Errorf("unexpected rpc success after %d errors", atomic.LoadUint32(&errCount))
}
if atomic.LoadUint32(&errCount) == 0 {
t.Errorf("expected at least 1 error(s), got none")
for atomic.LoadUint32(&errCount) == 0 {
if err := c.Call("TestRPCRcvr.Test", rpcVal, &num); err == nil {
// The connection is simply closed.
t.Errorf("unexpected rpc success after %d errors", atomic.LoadUint32(&errCount))
}
}
}