fix: itest: avoid failing the test when we race the miner

I've been seeing quite a few tests failing here, so I'm hoping this will
deflake them a bit.
This commit is contained in:
Steven Allen 2023-03-13 11:14:38 -07:00
parent 75c279ab97
commit b852f5e2fd

View File

@ -192,12 +192,15 @@ func (bm *BlockMiner) MineBlocksMustPost(ctx context.Context, blocktime time.Dur
reportSuccessFn := func(success bool, epoch abi.ChainEpoch, err error) {
// if api shuts down before mining, we may get an error which we should probably just ignore
// (fixing it will require rewriting most of the mining loop)
if err != nil && !strings.Contains(err.Error(), "websocket connection closed") && !api.ErrorIsIn(err, []error{new(jsonrpc.RPCConnectionError)}) {
if err != nil && ctx.Err() == nil && !strings.Contains(err.Error(), "websocket connection closed") && !api.ErrorIsIn(err, []error{new(jsonrpc.RPCConnectionError)}) {
require.NoError(bm.t, err)
}
target = epoch
wait <- success
select {
case wait <- success:
case <-ctx.Done():
}
}
var success bool