Merge pull request #6231 from heyitsanthony/fix-rafthttp-test

rafthttp: fix race in TestStreamWriterAttachOutgoingConn
This commit is contained in:
Xiang Li
2016-08-19 20:40:42 -07:00
committed by GitHub

View File

@ -59,11 +59,10 @@ func TestStreamWriterAttachOutgoingConn(t *testing.T) {
} }
} }
// msgc has been swapped with a new one now that prevwfc is closed // if prevwfc != nil, the new msgc is ready since prevwfc has closed
msgc, ok := sw.writec() // if prevwfc == nil, the first connection may be pending, but the first
if !ok { // msgc is already available since it's set on calling startStreamwriter
t.Errorf("#%d: working status = %v, want true", i, ok) msgc, _ := sw.writec()
}
msgc <- raftpb.Message{} msgc <- raftpb.Message{}
select { select {