fix: benchmarks broken in 15818 (#15934)

This commit is contained in:
Facundo Medica 2023-04-24 16:43:18 -03:00 committed by GitHub
parent 891f8be9e0
commit e3860acb04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 4 deletions

View File

@ -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{})
@ -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{})

View File

@ -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"
@ -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})