Skip to content

Commit

Permalink
set TestBlockPullerBadBlocks pullblock wait time (#2975)
Browse files Browse the repository at this point in the history
Limiting the test wait time. It will help to fail fast the testcase.

Signed-off-by: Parameswaran Selvam <parselva@in.ibm.com>
  • Loading branch information
Param-S committed Oct 11, 2021
1 parent b3cf25e commit 755ba79
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion orderer/common/cluster/deliver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1086,14 +1086,26 @@ func TestBlockPullerBadBlocks(t *testing.T) {
return nil
}))

bp.PullBlock(10)
endPullBlock := make(chan struct{})
go func() {
bp.PullBlock(10)
close(endPullBlock)
}()

select {
case <-detectedBadBlockDone:
case <-time.After(10 * time.Second):
t.Fatalf("expected %q to be logged but it was not seen", testCase.expectedErrMsg)
}

select {
case <-endPullBlock:
case <-time.After(10 * time.Second):
// Signal PullBlock to give up on the retries & mark the test as fail
close(bp.StopChannel)
t.Fatalf("PullBlock did not complete within time")
}

bp.Close()
dialer.assertAllConnectionsClosed(t)
})
Expand Down

0 comments on commit 755ba79

Please sign in to comment.