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

rafthttp: fix race in TestStreamWriterAttachOutgoingConn
release-3.1
Xiang Li 2016-08-19 20:40:42 -07:00 committed by GitHub
commit 8c88c1611e
1 changed files with 4 additions and 5 deletions

View File

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