From cd903bec5e05f236109a79342f9929d3de4f11d9 Mon Sep 17 00:00:00 2001 From: Dirk McCormick Date: Tue, 15 Jun 2021 17:24:57 +0200 Subject: [PATCH] refactor: sdr upgrade test to use kit2 --- itests/sdr_upgrade_test.go | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/itests/sdr_upgrade_test.go b/itests/sdr_upgrade_test.go index dfb4284b9..008c2ce61 100644 --- a/itests/sdr_upgrade_test.go +++ b/itests/sdr_upgrade_test.go @@ -10,15 +10,14 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/network" "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" - "github.com/filecoin-project/lotus/node/impl" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestSDRUpgrade(t *testing.T) { - kit.QuietMiningLogs() + kit2.QuietMiningLogs() // oldDelay := policy.GetPreCommitChallengeDelay() // policy.SetPreCommitChallengeDelay(5) @@ -31,18 +30,10 @@ func TestSDRUpgrade(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - n, sn := kit.MockMinerBuilder(t, []kit.FullNodeOpts{kit.FullNodeWithSDRAt(500, 1000)}, kit.OneMiner) - client := n[0].FullNode.(*impl.FullNodeAPI) - miner := sn[0] + opts := kit2.ConstructorOpts(kit2.SDRUpgradeAt(500, 1000)) + client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) + 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) pledge := make(chan struct{}) @@ -53,7 +44,7 @@ func TestSDRUpgrade(t *testing.T) { round := 0 for atomic.LoadInt64(&mine) != 0 { 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 { t.Error(err) @@ -88,7 +79,7 @@ func TestSDRUpgrade(t *testing.T) { }() // before. - kit.PledgeSectors(t, ctx, miner, 9, 0, pledge) + miner.PledgeSectors(ctx, 9, 0, pledge) s, err := miner.SectorsList(ctx) require.NoError(t, err)