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"
|
2020-10-05 12:14:43 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/urfave/cli/v2"
|
|
|
|
|
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")
|
|
|
|
}
|
|
|
|
|
|
|
|
_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-06-21 10:56:10 +00:00
|
|
|
client, miner, ens := kit.EnsembleMinimal(t)
|
|
|
|
ens.InterconnectAll().BeginMining(time.Second)
|
2020-10-05 12:14:43 +00:00
|
|
|
|
|
|
|
run := func(t *testing.T) {
|
|
|
|
app := cli.NewApp()
|
|
|
|
app.Metadata = map[string]interface{}{
|
|
|
|
"repoType": repo.StorageMiner,
|
2021-06-21 10:56:10 +00:00
|
|
|
"testnode-full": client,
|
|
|
|
"testnode-storage": miner,
|
2020-10-05 12:14:43 +00:00
|
|
|
}
|
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-21 17:19:26 +00:00
|
|
|
deal, res, inPath := dh.MakeOnlineDeal(context.Background(), kit.MakeFullDealParams{Rseed: 6})
|
2021-06-21 10:56:10 +00:00
|
|
|
outPath := dh.PerformRetrieval(context.Background(), deal, res.Root, false)
|
|
|
|
kit.AssertFilesEqual(t, inPath, outPath)
|
2020-10-05 12:14:43 +00:00
|
|
|
|
|
|
|
t.Run("post-info-all", run)
|
|
|
|
}
|