itests: Some kit cleanup
This commit is contained in:
parent
d0e87a7487
commit
9bdea91a70
@ -58,7 +58,7 @@ func TestPublishDealsBatching(t *testing.T) {
|
||||
_, err = client.WalletImport(ctx, &publisherKey.KeyInfo)
|
||||
require.NoError(t, err)
|
||||
|
||||
kit.SetControlAddresses(t, client, miner, publisherKey.Address)
|
||||
miner.SetControlAddresses(publisherKey.Address)
|
||||
|
||||
dh := kit.NewDealHarness(t, client, miner)
|
||||
|
||||
|
@ -2,7 +2,6 @@ package kit
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
@ -15,11 +14,11 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
func SetControlAddresses(t *testing.T, client *TestFullNode, w *TestMiner, addrs ...addr.Address) {
|
||||
func (tm *TestMiner) SetControlAddresses(addrs ...addr.Address) {
|
||||
ctx := context.TODO()
|
||||
|
||||
mi, err := client.StateMinerInfo(ctx, w.ActorAddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
mi, err := tm.FullNode.StateMinerInfo(ctx, tm.ActorAddr, types.EmptyTSK)
|
||||
require.NoError(tm.t, err)
|
||||
|
||||
cwp := &miner2.ChangeWorkerAddressParams{
|
||||
NewWorker: mi.Worker,
|
||||
@ -27,17 +26,17 @@ func SetControlAddresses(t *testing.T, client *TestFullNode, w *TestMiner, addrs
|
||||
}
|
||||
|
||||
sp, err := actors.SerializeParams(cwp)
|
||||
require.NoError(t, err)
|
||||
require.NoError(tm.t, err)
|
||||
|
||||
smsg, err := client.MpoolPushMessage(ctx, &types.Message{
|
||||
smsg, err := tm.FullNode.MpoolPushMessage(ctx, &types.Message{
|
||||
From: mi.Owner,
|
||||
To: w.ActorAddr,
|
||||
To: tm.ActorAddr,
|
||||
Method: miner.Methods.ChangeWorkerAddress,
|
||||
|
||||
Value: big.Zero(),
|
||||
Params: sp,
|
||||
}, nil)
|
||||
require.NoError(t, err)
|
||||
require.NoError(tm.t, err)
|
||||
|
||||
WaitMsg(ctx, t, client, smsg.Cid())
|
||||
tm.FullNode.WaitMsg(ctx, smsg.Cid())
|
||||
}
|
||||
|
@ -29,12 +29,12 @@ func SendFunds(ctx context.Context, t *testing.T, sender *TestFullNode, recipien
|
||||
sm, err := sender.MpoolPushMessage(ctx, msg, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
WaitMsg(ctx, t, sender, sm.Cid())
|
||||
sender.WaitMsg(ctx, sm.Cid())
|
||||
}
|
||||
|
||||
func WaitMsg(ctx context.Context, t *testing.T, node *TestFullNode, msg cid.Cid) {
|
||||
res, err := node.StateWaitMsg(ctx, msg, 3, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
func (f *TestFullNode) WaitMsg(ctx context.Context, msg cid.Cid) {
|
||||
res, err := f.StateWaitMsg(ctx, msg, 3, api.LookbackNoLimit, true)
|
||||
require.NoError(f.t, err)
|
||||
|
||||
require.EqualValues(t, 0, res.Receipt.ExitCode, "message did not successfully execute")
|
||||
require.EqualValues(f.t, 0, res.Receipt.ExitCode, "message did not successfully execute")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user