lotus/cmd/lotus-storage-miner/allinfo_test.go

68 lines
1.7 KiB
Go
Raw Normal View History

2020-10-05 12:14:43 +00:00
package main
import (
2021-05-21 13:33:48 +00:00
"context"
2020-10-05 12:14:43 +00:00
"flag"
"testing"
"time"
2021-05-21 13:33:48 +00:00
"github.com/filecoin-project/lotus/itests/kit"
"github.com/filecoin-project/lotus/node/impl"
2020-10-05 12:14:43 +00:00
logging "github.com/ipfs/go-log/v2"
"github.com/stretchr/testify/require"
"github.com/urfave/cli/v2"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/api"
2020-10-05 12:14:43 +00:00
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/node/repo"
)
func TestMinerAllInfo(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
_ = logging.SetLogLevel("*", "INFO")
policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048))
policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1)
policy.SetMinVerifiedDealSize(abi.NewStoragePower(256))
_test = true
2021-05-21 13:33:48 +00:00
kit.QuietMiningLogs()
2020-10-05 12:14:43 +00:00
oldDelay := policy.GetPreCommitChallengeDelay()
policy.SetPreCommitChallengeDelay(5)
t.Cleanup(func() {
policy.SetPreCommitChallengeDelay(oldDelay)
})
n, sn := kit.Builder(t, kit.OneFull, kit.OneMiner)
2021-05-21 13:33:48 +00:00
client, miner := n[0].FullNode, sn[0]
kit.ConnectAndStartMining(t, time.Second, miner, client.(*impl.FullNodeAPI))
2020-10-05 12:14:43 +00:00
run := func(t *testing.T) {
app := cli.NewApp()
app.Metadata = map[string]interface{}{
"repoType": repo.StorageMiner,
"testnode-full": n[0],
"testnode-storage": sn[0],
}
api.RunningNodeType = api.NodeMiner
2020-10-05 12:14:43 +00:00
cctx := cli.NewContext(app, flag.NewFlagSet("", flag.ContinueOnError), nil)
require.NoError(t, infoAllCmd.Action(cctx))
}
2021-05-21 13:33:48 +00:00
t.Run("pre-info-all", run)
2020-10-05 12:14:43 +00:00
2021-05-21 13:33:48 +00:00
dh := kit.NewDealHarness(t, client, miner)
dh.MakeFullDeal(context.Background(), 6, false, false, 0)
2020-10-05 12:14:43 +00:00
t.Run("post-info-all", run)
}