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"
|
|
|
|
|
2021-03-05 21:01:20 +00:00
|
|
|
"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)
|
|
|
|
})
|
|
|
|
|
2021-05-21 13:33:48 +00:00
|
|
|
n, sn := kit.Builder(t, kit.OneFull, kit.OneMiner)
|
|
|
|
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],
|
|
|
|
}
|
2021-03-05 21:01:20 +00:00
|
|
|
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)
|
2021-06-14 04:10:34 +00:00
|
|
|
_, _, _ = dh.MakeFullDeal(kit.MakeFullDealParams{
|
|
|
|
Ctx: context.Background(),
|
|
|
|
Rseed: 6,
|
|
|
|
CarExport: false,
|
|
|
|
FastRet: false,
|
|
|
|
StartEpoch: 0,
|
|
|
|
DoRetrieval: true,
|
|
|
|
})
|
2020-10-05 12:14:43 +00:00
|
|
|
|
|
|
|
t.Run("post-info-all", run)
|
|
|
|
}
|