[go: up one dir, main page]

Skip to content

Commit

Permalink
Unit test flake when rpc server stream not closed (backport #2935) (#…
Browse files Browse the repository at this point in the history
…2942)

Signed-off-by: David Enyeart <enyeart@us.ibm.com>
  • Loading branch information
denyeart authored Sep 21, 2021
1 parent 19a137b commit eddb470
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion orderer/common/cluster/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,20 @@ func TestSendSubmitWithReport(t *testing.T) {
node2.stop()
node2.resurrect()

/*
* allow the node2 to restart completely
* if restart not complete, the existing stream able to successfully send
* the next SubmitRequest which makes the testcase fails. Hence this delay
* required
*/
time.Sleep(time.Second * 5)

var wg2 sync.WaitGroup
wg2.Add(1)

reportSubmitFailed := func(err error) {
assert.EqualError(t, err, io.EOF.Error())
defer wg2.Done()
assert.EqualError(t, err, io.EOF.Error())
}

err = node1RPC.SendSubmit(node2.nodeInfo.ID, &orderer.SubmitRequest{Channel: testChannel, Payload: &common.Envelope{Payload: []byte("2")}}, reportSubmitFailed)
Expand Down

0 comments on commit eddb470

Please sign in to comment.