Skip to content

Commit

Permalink
fix test revert change ,fetch new head if receive old chain head (#4314)
Browse files Browse the repository at this point in the history
  • Loading branch information
hunjixin authored Jan 15, 2021
1 parent b1e6887 commit b83e0b5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pkg/chain/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ package chain_test

import (
"context"
"testing"
"time"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/venus/pkg/config"
"github.com/filecoin-project/venus/pkg/util/test"

"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"

"github.com/filecoin-project/venus/pkg/block"
"github.com/filecoin-project/venus/pkg/chain"
Expand Down Expand Up @@ -175,10 +172,12 @@ func TestRevertChange(t *testing.T) {

err = cs.SetHead(ctx, link6)
require.NoError(t, err)

time.Sleep(time.Second)
headChanges := <-ch

if len(headChanges) == 1 {
//maybe link3, if link3 fetch next
headChanges = <-ch
}
test.Equal(t, headChanges[0].Type, chain.HCRevert)
test.Equal(t, headChanges[0].Val, link1)
test.Equal(t, headChanges[1].Type, chain.HCRevert)
Expand Down

0 comments on commit b83e0b5

Please sign in to comment.