Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
DongLieu committed Nov 25, 2024
1 parent bb58fc6 commit 69879a4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions tests/integration/accounts/base_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ func TestBaseAccount(t *testing.T) {
}

func sendTx(t *testing.T, ctx sdk.Context, app *simapp.SimApp, sender []byte, msg sdk.Msg) {
t.Helper()
tx := sign(t, ctx, app, sender, privKey, msg)
_, _, err := app.SimDeliver(app.TxEncode, tx)
require.NoError(t, err)
}

func sign(t *testing.T, ctx sdk.Context, app *simapp.SimApp, from sdk.AccAddress, privKey cryptotypes.PrivKey, msg sdk.Msg) sdk.Tx {
t.Helper()
r := rand.New(rand.NewSource(0))

accNum, err := app.AccountsKeeper.AccountByNumber.Get(ctx, from)
Expand All @@ -81,12 +83,14 @@ func sign(t *testing.T, ctx sdk.Context, app *simapp.SimApp, from sdk.AccAddress
}

func bechify(t *testing.T, app *simapp.SimApp, addr []byte) string {
t.Helper()
bech32, err := app.AuthKeeper.AddressCodec().BytesToString(addr)
require.NoError(t, err)
return bech32
}

func fundAccount(t *testing.T, app *simapp.SimApp, ctx sdk.Context, addr sdk.AccAddress, amt string) {
t.Helper()
require.NoError(t, testutil.FundAccount(ctx, app.BankKeeper, addr, coins(t, amt)))
}

Expand Down
1 change: 1 addition & 0 deletions tests/integration/accounts/bundler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ func TestMsgServer_ExecuteBundle(t *testing.T) {
}

func makeTx(t *testing.T, msg gogoproto.Message, sig []byte, xt *account_abstractionv1.TxExtension) []byte {
t.Helper()
anyMsg, err := codectypes.NewAnyWithValue(msg)
require.NoError(t, err)

Expand Down
7 changes: 3 additions & 4 deletions tests/systemtests/rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (r RPCClient) Invoke(ctx context.Context, method string, req, reply interfa
var height int64
md, _ := metadata.FromOutgoingContext(ctx)
if heights := md.Get(grpctypes.GRPCBlockHeightHeader); len(heights) > 0 {
height, err := strconv.ParseInt(heights[0], 10, 64)
height, err = strconv.ParseInt(heights[0], 10, 64)
if err != nil {
return err
}
Expand All @@ -71,9 +71,8 @@ func (r RPCClient) Invoke(ctx context.Context, method string, req, reply interfa
}

abciReq := abci.QueryRequest{
Path: method,
Data: reqBz,
Height: height,
Path: method,
Data: reqBz,
}

abciOpts := rpcclient.ABCIQueryOptions{
Expand Down
3 changes: 2 additions & 1 deletion tests/systemtests/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,8 @@ func (l *EventListener) Subscribe(query string, cb EventConsumer) func() {
eventsChan, err := l.client.WSEvents.Subscribe(ctx, "testing", query)
require.NoError(l.t, err)
cleanup := func() {
ctx, _ := context.WithTimeout(ctx, DefaultWaitTime) //nolint:govet // used in cleanup only
ctx, cancel := context.WithTimeout(ctx, DefaultWaitTime) //nolint:govet // used in cleanup only
defer cancel()
go l.client.WSEvents.Unsubscribe(ctx, "testing", query) //nolint:errcheck // used by tests only
done()
}
Expand Down

0 comments on commit 69879a4

Please sign in to comment.