move init to main, add more logging

This commit is contained in:
Anton Evangelatov 2020-06-24 16:46:12 +02:00
parent f460d24f65
commit bb758854fb
3 changed files with 32 additions and 20 deletions

View File

@ -82,15 +82,15 @@ func runBaselineMiner(t *TestEnvironment) error {
go func() { go func() {
defer close(done) defer close(done)
for mine { for mine {
time.Sleep(10 * time.Millisecond) time.Sleep(10 * time.Second)
//t.RecordMessage("mine one block") t.RecordMessage("mine one block")
if err := miner.MineOne(ctx, func(bool) {}); err != nil { if err := miner.MineOne(ctx, func(bool) {}); err != nil {
panic(err) panic(err)
} }
} }
}() }()
time.Sleep(300 * time.Second) time.Sleep(3600 * time.Second)
mine = false mine = false
fmt.Println("shutting down mining") fmt.Println("shutting down mining")
<-done <-done
@ -122,6 +122,8 @@ func runBaselineClient(t *TestEnvironment) error {
t.RecordMessage("client connected to miner") t.RecordMessage("client connected to miner")
time.Sleep(10 * time.Second)
// generate random data // generate random data
data := make([]byte, 1600) data := make([]byte, 1600)
rand.New(rand.NewSource(time.Now().UnixNano())).Read(data) rand.New(rand.NewSource(time.Now().UnixNano())).Read(data)
@ -137,7 +139,7 @@ func runBaselineClient(t *TestEnvironment) error {
t.RecordMessage("started deal: %s", deal) t.RecordMessage("started deal: %s", deal)
// TODO: this sleep is only necessary because deals don't immediately get logged in the dealstore, we should fix this // TODO: this sleep is only necessary because deals don't immediately get logged in the dealstore, we should fix this
time.Sleep(3 * time.Second) time.Sleep(5 * time.Second)
t.RecordMessage("wait to be sealed") t.RecordMessage("wait to be sealed")
waitDealSealed(ctx, client, deal) waitDealSealed(ctx, client, deal)

View File

@ -3,14 +3,40 @@ package main
import ( import (
"fmt" "fmt"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/abi/big"
"github.com/filecoin-project/specs-actors/actors/builtin/power"
"github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
"github.com/testground/sdk-go/run" "github.com/testground/sdk-go/run"
"github.com/testground/sdk-go/runtime" "github.com/testground/sdk-go/runtime"
saminer "github.com/filecoin-project/specs-actors/actors/builtin/miner"
logging "github.com/ipfs/go-log/v2"
) )
var testplans = map[string]interface{}{ var testplans = map[string]interface{}{
"lotus-baseline": doRun(baselineRoles), "lotus-baseline": doRun(baselineRoles),
} }
func init() {
logging.SetLogLevel("vm", "WARN")
logging.SetLogLevel("miner", "WARN")
logging.SetLogLevel("chainstore", "WARN")
logging.SetLogLevel("chain", "WARN")
logging.SetLogLevel("sub", "WARN")
logging.SetLogLevel("storageminer", "WARN")
build.DisableBuiltinAssets = true
// Note: I don't understand the significance of this, but the node test does it.
power.ConsensusMinerMinPower = big.NewInt(2048)
saminer.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
}
verifreg.MinVerifiedDealSize = big.NewInt(256)
}
func main() { func main() {
run.InvokeMap(testplans) run.InvokeMap(testplans)
} }

View File

@ -14,7 +14,6 @@ import (
"github.com/testground/sdk-go/runtime" "github.com/testground/sdk-go/runtime"
"github.com/testground/sdk-go/sync" "github.com/testground/sdk-go/sync"
logging "github.com/ipfs/go-log/v2"
libp2p_crypto "github.com/libp2p/go-libp2p-core/crypto" libp2p_crypto "github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peer"
ma "github.com/multiformats/go-multiaddr" ma "github.com/multiformats/go-multiaddr"
@ -40,13 +39,11 @@ import (
"github.com/filecoin-project/lotus/node/modules/lp2p" "github.com/filecoin-project/lotus/node/modules/lp2p"
modtest "github.com/filecoin-project/lotus/node/modules/testing" modtest "github.com/filecoin-project/lotus/node/modules/testing"
"github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/node/repo"
"github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
"github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/abi/big" "github.com/filecoin-project/specs-actors/actors/abi/big"
"github.com/filecoin-project/specs-actors/actors/builtin" "github.com/filecoin-project/specs-actors/actors/builtin"
saminer "github.com/filecoin-project/specs-actors/actors/builtin/miner" saminer "github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/specs-actors/actors/builtin/power"
"github.com/filecoin-project/specs-actors/actors/crypto" "github.com/filecoin-project/specs-actors/actors/crypto"
) )
@ -95,19 +92,6 @@ type MinerAddresses struct {
ActorAddr address.Address ActorAddr address.Address
} }
func init() {
logging.SetLogLevel("vm", "WARN")
build.DisableBuiltinAssets = true
// Note: I don't understand the significance of this, but the node test does it.
power.ConsensusMinerMinPower = big.NewInt(2048)
saminer.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
}
verifreg.MinVerifiedDealSize = big.NewInt(256)
}
func prepareBootstrapper(t *TestEnvironment) (*Node, error) { func prepareBootstrapper(t *TestEnvironment) (*Node, error) {
ctx, cancel := context.WithTimeout(context.Background(), PrepareNodeTimeout) ctx, cancel := context.WithTimeout(context.Background(), PrepareNodeTimeout)
defer cancel() defer cancel()