-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4166 from filecoin-project/test/miner-allinfo
Test lotus-miner info all
- Loading branch information
Showing
4 changed files
with
104 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"testing" | ||
"time" | ||
|
||
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/test" | ||
"github.com/filecoin-project/lotus/build" | ||
"github.com/filecoin-project/lotus/chain/actors/policy" | ||
"github.com/filecoin-project/lotus/lib/lotuslog" | ||
"github.com/filecoin-project/lotus/node/repo" | ||
builder "github.com/filecoin-project/lotus/node/test" | ||
) | ||
|
||
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 | ||
|
||
lotuslog.SetupLogLevels() | ||
logging.SetLogLevel("miner", "ERROR") | ||
logging.SetLogLevel("chainstore", "ERROR") | ||
logging.SetLogLevel("chain", "ERROR") | ||
logging.SetLogLevel("sub", "ERROR") | ||
logging.SetLogLevel("storageminer", "ERROR") | ||
|
||
oldDelay := policy.GetPreCommitChallengeDelay() | ||
policy.SetPreCommitChallengeDelay(5) | ||
t.Cleanup(func() { | ||
policy.SetPreCommitChallengeDelay(oldDelay) | ||
}) | ||
|
||
var n []test.TestNode | ||
var sn []test.TestStorageNode | ||
|
||
run := func(t *testing.T) { | ||
app := cli.NewApp() | ||
app.Metadata = map[string]interface{}{ | ||
"repoType": repo.StorageMiner, | ||
"testnode-full": n[0], | ||
"testnode-storage": sn[0], | ||
} | ||
build.RunningNodeType = build.NodeMiner | ||
|
||
cctx := cli.NewContext(app, flag.NewFlagSet("", flag.ContinueOnError), nil) | ||
|
||
require.NoError(t, infoAllCmd.Action(cctx)) | ||
} | ||
|
||
bp := func(t *testing.T, nFull int, storage []test.StorageMiner) ([]test.TestNode, []test.TestStorageNode) { | ||
n, sn = builder.Builder(t, nFull, storage) | ||
|
||
t.Run("pre-info-all", run) | ||
|
||
return n, sn | ||
} | ||
|
||
test.TestDealFlow(t, bp, time.Second, false, false) | ||
|
||
t.Run("post-info-all", run) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters