fix TestWorkerKeyChange.
This commit is contained in:
parent
cd6f91ba6f
commit
40ea660cdd
@ -7,7 +7,6 @@ import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -22,7 +21,6 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/itests/kit"
|
||||
"github.com/filecoin-project/lotus/lib/lotuslog"
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
)
|
||||
|
||||
@ -40,20 +38,16 @@ func TestWorkerKeyChange(t *testing.T) {
|
||||
policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1)
|
||||
policy.SetMinVerifiedDealSize(abi.NewStoragePower(256))
|
||||
|
||||
lotuslog.SetupLogLevels()
|
||||
logging.SetLogLevel("miner", "ERROR")
|
||||
logging.SetLogLevel("chainstore", "ERROR")
|
||||
logging.SetLogLevel("chain", "ERROR")
|
||||
logging.SetLogLevel("pubsub", "ERROR")
|
||||
logging.SetLogLevel("sub", "ERROR")
|
||||
logging.SetLogLevel("storageminer", "ERROR")
|
||||
kit.QuietMiningLogs()
|
||||
|
||||
blocktime := 1 * time.Millisecond
|
||||
|
||||
n, sn := kit.MockMinerBuilder(t, []kit.FullNodeOpts{kit.FullNodeWithLatestActorsAt(-1), kit.FullNodeWithLatestActorsAt(-1)}, kit.OneMiner)
|
||||
clients, miners := kit.MockMinerBuilder(t,
|
||||
[]kit.FullNodeOpts{kit.FullNodeWithLatestActorsAt(-1), kit.FullNodeWithLatestActorsAt(-1)},
|
||||
kit.OneMiner)
|
||||
|
||||
client1 := n[0]
|
||||
client2 := n[1]
|
||||
client1 := clients[0]
|
||||
client2 := clients[1]
|
||||
|
||||
// Connect the nodes.
|
||||
addrinfo, err := client1.NetAddrsListen(ctx)
|
||||
@ -66,8 +60,8 @@ func TestWorkerKeyChange(t *testing.T) {
|
||||
app := cli.NewApp()
|
||||
app.Metadata = map[string]interface{}{
|
||||
"repoType": repo.StorageMiner,
|
||||
"testnode-full": n[0],
|
||||
"testnode-storage": sn[0],
|
||||
"testnode-full": clients[0],
|
||||
"testnode-storage": miners[0],
|
||||
}
|
||||
app.Writer = output
|
||||
api.RunningNodeType = api.NodeMiner
|
||||
@ -84,23 +78,8 @@ func TestWorkerKeyChange(t *testing.T) {
|
||||
return cmd.Action(cctx)
|
||||
}
|
||||
|
||||
// setup miner
|
||||
mine := int64(1)
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
defer close(done)
|
||||
for atomic.LoadInt64(&mine) == 1 {
|
||||
time.Sleep(blocktime)
|
||||
if err := sn[0].MineOne(ctx, kit.MineNext); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
defer func() {
|
||||
atomic.AddInt64(&mine, -1)
|
||||
fmt.Println("shutting down mining")
|
||||
<-done
|
||||
}()
|
||||
// start mining
|
||||
kit.ConnectAndStartMining(t, blocktime, miners[0], client1, client2)
|
||||
|
||||
newKey, err := client1.WalletNew(ctx, types.KTBLS)
|
||||
require.NoError(t, err)
|
||||
|
Loading…
Reference in New Issue
Block a user