Skip to content

Commit

Permalink
itests: Some kit cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Jul 7, 2021
1 parent d0e87a7 commit 3069313
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions itests/kit/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
"github.com/filecoin-project/lotus/chain/types"
)

func SetControlAddresses(t *testing.T, client *TestFullNode, w *TestMiner, addrs ...addr.Address) {
func (tm *TestMiner) SetControlAddresses(t *testing.T, addrs ...addr.Address) {
ctx := context.TODO()

mi, err := client.StateMinerInfo(ctx, w.ActorAddr, types.EmptyTSK)
mi, err := tm.FullNode.StateMinerInfo(ctx, tm.ActorAddr, types.EmptyTSK)
require.NoError(t, err)

cwp := &miner2.ChangeWorkerAddressParams{
Expand All @@ -29,15 +29,15 @@ func SetControlAddresses(t *testing.T, client *TestFullNode, w *TestMiner, addrs
sp, err := actors.SerializeParams(cwp)
require.NoError(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)

WaitMsg(ctx, t, client, smsg.Cid())
tm.FullNode.WaitMsg(ctx, smsg.Cid())
}
10 changes: 5 additions & 5 deletions itests/kit/funds.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

0 comments on commit 3069313

Please sign in to comment.