Skip to content

Commit

Permalink
fix: benchmarks broken in 15818 (#15934)
Browse files Browse the repository at this point in the history
  • Loading branch information
facundomedica authored Apr 24, 2023
1 parent 891f8be commit e3860ac
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
19 changes: 16 additions & 3 deletions x/auth/keeper/keeper_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,27 @@ package keeper_test
import (
"testing"

"cosmossdk.io/depinject"
"cosmossdk.io/log"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/stretchr/testify/require"

simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/testutil"
"github.com/stretchr/testify/require"
)

func BenchmarkAccountMapperGetAccountFound(b *testing.B) {
b.ReportAllocs()
var accountKeeper keeper.AccountKeeper
app, err := simtestutil.Setup(testutil.AppConfig, &accountKeeper)
app, err := simtestutil.Setup(
depinject.Configs(
depinject.Supply(log.NewNopLogger()),
testutil.AppConfig,
),
&accountKeeper,
)
require.NoError(b, err)

ctx := app.BaseApp.NewContext(false, cmtproto.Header{})
Expand All @@ -37,7 +46,11 @@ func BenchmarkAccountMapperGetAccountFound(b *testing.B) {
func BenchmarkAccountMapperSetAccount(b *testing.B) {
b.ReportAllocs()
var accountKeeper keeper.AccountKeeper
app, err := simtestutil.Setup(testutil.AppConfig, &accountKeeper)
app, err := simtestutil.Setup(
depinject.Configs(
depinject.Supply(log.NewNopLogger()),
testutil.AppConfig,
), &accountKeeper)
require.NoError(b, err)

ctx := app.BaseApp.NewContext(false, cmtproto.Header{})
Expand Down
9 changes: 8 additions & 1 deletion x/evidence/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"testing"
"time"

"cosmossdk.io/depinject"
"cosmossdk.io/log"
"cosmossdk.io/x/evidence"
"cosmossdk.io/x/evidence/exported"
"cosmossdk.io/x/evidence/keeper"
Expand All @@ -29,7 +31,12 @@ type GenesisTestSuite struct {
func (suite *GenesisTestSuite) SetupTest() {
var evidenceKeeper keeper.Keeper

app, err := simtestutil.Setup(testutil.AppConfig, &evidenceKeeper)
app, err := simtestutil.Setup(
depinject.Configs(
depinject.Supply(log.NewNopLogger()),
testutil.AppConfig,
),
&evidenceKeeper)
require.NoError(suite.T(), err)

suite.ctx = app.BaseApp.NewContext(false, cmtproto.Header{Height: 1})
Expand Down

0 comments on commit e3860ac

Please sign in to comment.