fix tests
This commit is contained in:
parent
4f0ab4f226
commit
d9faff19a5
@ -46,6 +46,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
power.ConsensusMinerMinPower = big.NewInt(2048)
|
power.ConsensusMinerMinPower = big.NewInt(2048)
|
||||||
verifreg.MinVerifiedDealSize = big.NewInt(256)
|
verifreg.MinVerifiedDealSize = big.NewInt(256)
|
||||||
|
|
||||||
|
modules.PubsubSubscribeImmediately = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const source = 0
|
const source = 0
|
||||||
|
@ -29,6 +29,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
"github.com/filecoin-project/lotus/node/modules"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api/test"
|
"github.com/filecoin-project/lotus/api/test"
|
||||||
"github.com/filecoin-project/lotus/chain/wallet"
|
"github.com/filecoin-project/lotus/chain/wallet"
|
||||||
@ -44,6 +45,8 @@ func init() {
|
|||||||
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
||||||
}
|
}
|
||||||
verifreg.MinVerifiedDealSize = big.NewInt(256)
|
verifreg.MinVerifiedDealSize = big.NewInt(256)
|
||||||
|
|
||||||
|
modules.PubsubSubscribeImmediately = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestPaymentChannels does a basic test to exercise the payment channel CLI
|
// TestPaymentChannels does a basic test to exercise the payment channel CLI
|
||||||
|
@ -31,6 +31,9 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/node/modules/helpers"
|
"github.com/filecoin-project/lotus/node/modules/helpers"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// for tests
|
||||||
|
var PubsubSubscribeImmediately = false
|
||||||
|
|
||||||
func RunHello(mctx helpers.MetricsCtx, lc fx.Lifecycle, h host.Host, svc *hello.Service) error {
|
func RunHello(mctx helpers.MetricsCtx, lc fx.Lifecycle, h host.Host, svc *hello.Service) error {
|
||||||
h.SetStreamHandler(hello.ProtocolID, svc.HandleStream)
|
h.SetStreamHandler(hello.ProtocolID, svc.HandleStream)
|
||||||
|
|
||||||
@ -126,8 +129,7 @@ func HandleIncomingBlocks(mctx helpers.MetricsCtx, lc fx.Lifecycle, ps *pubsub.P
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait until we are synced within 10 blocks
|
subscribe := func() {
|
||||||
waitForSync(stmgr, 10, func() {
|
|
||||||
log.Infof("subscribing to pubsub topic %s", build.BlocksTopic(nn))
|
log.Infof("subscribing to pubsub topic %s", build.BlocksTopic(nn))
|
||||||
|
|
||||||
blocksub, err := ps.Subscribe(build.BlocksTopic(nn)) //nolint
|
blocksub, err := ps.Subscribe(build.BlocksTopic(nn)) //nolint
|
||||||
@ -136,7 +138,16 @@ func HandleIncomingBlocks(mctx helpers.MetricsCtx, lc fx.Lifecycle, ps *pubsub.P
|
|||||||
}
|
}
|
||||||
|
|
||||||
go sub.HandleIncomingBlocks(ctx, blocksub, s, bserv, h.ConnManager())
|
go sub.HandleIncomingBlocks(ctx, blocksub, s, bserv, h.ConnManager())
|
||||||
})
|
}
|
||||||
|
|
||||||
|
// for tests
|
||||||
|
if PubsubSubscribeImmediately {
|
||||||
|
subscribe()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait until we are synced within 10 blocks
|
||||||
|
waitForSync(stmgr, 10, subscribe)
|
||||||
}
|
}
|
||||||
|
|
||||||
func HandleIncomingMessages(mctx helpers.MetricsCtx, lc fx.Lifecycle, ps *pubsub.PubSub, stmgr *stmgr.StateManager, mpool *messagepool.MessagePool, h host.Host, nn dtypes.NetworkName) {
|
func HandleIncomingMessages(mctx helpers.MetricsCtx, lc fx.Lifecycle, ps *pubsub.PubSub, stmgr *stmgr.StateManager, mpool *messagepool.MessagePool, h host.Host, nn dtypes.NetworkName) {
|
||||||
@ -148,8 +159,7 @@ func HandleIncomingMessages(mctx helpers.MetricsCtx, lc fx.Lifecycle, ps *pubsub
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait until we are synced within 1 block
|
subscribe := func() {
|
||||||
waitForSync(stmgr, 1, func() {
|
|
||||||
log.Infof("subscribing to pubsub topic %s", build.MessagesTopic(nn))
|
log.Infof("subscribing to pubsub topic %s", build.MessagesTopic(nn))
|
||||||
|
|
||||||
msgsub, err := ps.Subscribe(build.MessagesTopic(nn)) //nolint
|
msgsub, err := ps.Subscribe(build.MessagesTopic(nn)) //nolint
|
||||||
@ -158,7 +168,16 @@ func HandleIncomingMessages(mctx helpers.MetricsCtx, lc fx.Lifecycle, ps *pubsub
|
|||||||
}
|
}
|
||||||
|
|
||||||
go sub.HandleIncomingMessages(ctx, mpool, msgsub)
|
go sub.HandleIncomingMessages(ctx, mpool, msgsub)
|
||||||
})
|
}
|
||||||
|
|
||||||
|
// for tests
|
||||||
|
if PubsubSubscribeImmediately {
|
||||||
|
subscribe()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait until we are synced within 1 block
|
||||||
|
waitForSync(stmgr, 1, subscribe)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLocalDiscovery(ds dtypes.MetadataDS) *discovery.Local {
|
func NewLocalDiscovery(ds dtypes.MetadataDS) *discovery.Local {
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api/test"
|
"github.com/filecoin-project/lotus/api/test"
|
||||||
|
"github.com/filecoin-project/lotus/node/modules"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -26,6 +27,8 @@ func init() {
|
|||||||
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
||||||
}
|
}
|
||||||
verifreg.MinVerifiedDealSize = big.NewInt(256)
|
verifreg.MinVerifiedDealSize = big.NewInt(256)
|
||||||
|
|
||||||
|
modules.PubsubSubscribeImmediately = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAPI(t *testing.T) {
|
func TestAPI(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user