Skip to content

Commit

Permalink
Merge pull request #4609 from filecoin-project/fix/flaky-testMiningReal
Browse files Browse the repository at this point in the history
Fix flaky testMiningReal
  • Loading branch information
magik6k authored Oct 27, 2020
2 parents 1db69ac + efc8d90 commit 3d02dba
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions api/test/mining.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,11 @@ func (ts *testSuite) testMiningReal(t *testing.T) {

newHeads, err := api.ChainNotify(ctx)
require.NoError(t, err)
initHead := (<-newHeads)[0]
if initHead.Val.Height() != 2 {
<-newHeads
}
at := (<-newHeads)[0].Val.Height()

h1, err := api.ChainHead(ctx)
require.NoError(t, err)
require.Equal(t, abi.ChainEpoch(2), h1.Height())
require.Equal(t, int64(at), int64(h1.Height()))

MineUntilBlock(ctx, t, apis[0], sn[0], nil)
require.NoError(t, err)
Expand All @@ -74,16 +71,16 @@ func (ts *testSuite) testMiningReal(t *testing.T) {

h2, err := api.ChainHead(ctx)
require.NoError(t, err)
require.Equal(t, abi.ChainEpoch(3), h2.Height())
require.Greater(t, int64(h2.Height()), int64(h1.Height()))

MineUntilBlock(ctx, t, apis[0], sn[0], nil)
require.NoError(t, err)

<-newHeads

h2, err = api.ChainHead(ctx)
h3, err := api.ChainHead(ctx)
require.NoError(t, err)
require.Equal(t, abi.ChainEpoch(4), h2.Height())
require.Greater(t, int64(h3.Height()), int64(h2.Height()))
}

func TestDealMining(t *testing.T, b APIBuilder, blocktime time.Duration, carExport bool) {
Expand Down

0 comments on commit 3d02dba

Please sign in to comment.