Merge pull request #10461 from filecoin-project/steb/deflake-fail-after-finish
fix: itest: avoid failing the test when we race the miner
This commit is contained in:
commit
97a9921cdd
@ -192,12 +192,15 @@ func (bm *BlockMiner) MineBlocksMustPost(ctx context.Context, blocktime time.Dur
|
|||||||
reportSuccessFn := func(success bool, epoch abi.ChainEpoch, err error) {
|
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
|
// 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)
|
// (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)
|
require.NoError(bm.t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
target = epoch
|
target = epoch
|
||||||
wait <- success
|
select {
|
||||||
|
case wait <- success:
|
||||||
|
case <-ctx.Done():
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var success bool
|
var success bool
|
||||||
|
Loading…
Reference in New Issue
Block a user