Merge pull request #6488 from filecoin-project/refactor/itest-sdr-upgrade
This commit is contained in:
commit
06cb3cf132
@ -10,15 +10,14 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/network"
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/itests/kit"
|
"github.com/filecoin-project/lotus/itests/kit2"
|
||||||
bminer "github.com/filecoin-project/lotus/miner"
|
bminer "github.com/filecoin-project/lotus/miner"
|
||||||
"github.com/filecoin-project/lotus/node/impl"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSDRUpgrade(t *testing.T) {
|
func TestSDRUpgrade(t *testing.T) {
|
||||||
kit.QuietMiningLogs()
|
kit2.QuietMiningLogs()
|
||||||
|
|
||||||
// oldDelay := policy.GetPreCommitChallengeDelay()
|
// oldDelay := policy.GetPreCommitChallengeDelay()
|
||||||
// policy.SetPreCommitChallengeDelay(5)
|
// policy.SetPreCommitChallengeDelay(5)
|
||||||
@ -31,18 +30,10 @@ func TestSDRUpgrade(t *testing.T) {
|
|||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
n, sn := kit.MockMinerBuilder(t, []kit.FullNodeOpts{kit.FullNodeWithSDRAt(500, 1000)}, kit.OneMiner)
|
opts := kit2.ConstructorOpts(kit2.SDRUpgradeAt(500, 1000))
|
||||||
client := n[0].FullNode.(*impl.FullNodeAPI)
|
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts)
|
||||||
miner := sn[0]
|
ens.InterconnectAll()
|
||||||
|
|
||||||
addrinfo, err := client.NetAddrsListen(ctx)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := miner.NetConnect(ctx, addrinfo); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
build.Clock.Sleep(time.Second)
|
build.Clock.Sleep(time.Second)
|
||||||
|
|
||||||
pledge := make(chan struct{})
|
pledge := make(chan struct{})
|
||||||
@ -53,7 +44,7 @@ func TestSDRUpgrade(t *testing.T) {
|
|||||||
round := 0
|
round := 0
|
||||||
for atomic.LoadInt64(&mine) != 0 {
|
for atomic.LoadInt64(&mine) != 0 {
|
||||||
build.Clock.Sleep(blocktime)
|
build.Clock.Sleep(blocktime)
|
||||||
if err := sn[0].MineOne(ctx, bminer.MineReq{Done: func(bool, abi.ChainEpoch, error) {
|
if err := miner.MineOne(ctx, bminer.MineReq{Done: func(bool, abi.ChainEpoch, error) {
|
||||||
|
|
||||||
}}); err != nil {
|
}}); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
@ -88,7 +79,7 @@ func TestSDRUpgrade(t *testing.T) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
// before.
|
// before.
|
||||||
kit.PledgeSectors(t, ctx, miner, 9, 0, pledge)
|
miner.PledgeSectors(ctx, 9, 0, pledge)
|
||||||
|
|
||||||
s, err := miner.SectorsList(ctx)
|
s, err := miner.SectorsList(ctx)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user