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:
parent
95fd8b5c56
commit
9a9119af9d
11
cmux_test.go
11
cmux_test.go
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user