Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(baseapp): use no-op logger #17528

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions baseapp/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestABCI_First_block_Height(t *testing.T) {
func TestABCI_InitChain(t *testing.T) {
name := t.Name()
db := dbm.NewMemDB()
logger := log.NewTestLogger(t)
logger := log.NewNopLogger()
app := baseapp.NewBaseApp(name, logger, db, nil, baseapp.SetChainID("test-chain-id"))

capKey := storetypes.NewKVStoreKey("main")
Expand Down Expand Up @@ -180,7 +180,7 @@ func TestABCI_InitChain(t *testing.T) {
func TestABCI_InitChain_WithInitialHeight(t *testing.T) {
name := t.Name()
db := dbm.NewMemDB()
app := baseapp.NewBaseApp(name, log.NewTestLogger(t), db, nil)
app := baseapp.NewBaseApp(name, log.NewNopLogger(), db, nil)

_, err := app.InitChain(
&abci.RequestInitChain{
Expand All @@ -197,7 +197,7 @@ func TestABCI_InitChain_WithInitialHeight(t *testing.T) {
func TestABCI_FinalizeBlock_WithInitialHeight(t *testing.T) {
name := t.Name()
db := dbm.NewMemDB()
app := baseapp.NewBaseApp(name, log.NewTestLogger(t), db, nil)
app := baseapp.NewBaseApp(name, log.NewNopLogger(), db, nil)

_, err := app.InitChain(
&abci.RequestInitChain{
Expand All @@ -219,7 +219,7 @@ func TestABCI_FinalizeBlock_WithInitialHeight(t *testing.T) {
func TestABCI_FinalizeBlock_WithBeginAndEndBlocker(t *testing.T) {
name := t.Name()
db := dbm.NewMemDB()
app := baseapp.NewBaseApp(name, log.NewTestLogger(t), db, nil)
app := baseapp.NewBaseApp(name, log.NewNopLogger(), db, nil)

app.SetBeginBlocker(func(ctx sdk.Context) (sdk.BeginBlock, error) {
return sdk.BeginBlock{
Expand Down Expand Up @@ -286,7 +286,7 @@ func TestABCI_FinalizeBlock_WithBeginAndEndBlocker(t *testing.T) {
func TestABCI_ExtendVote(t *testing.T) {
name := t.Name()
db := dbm.NewMemDB()
app := baseapp.NewBaseApp(name, log.NewTestLogger(t), db, nil)
app := baseapp.NewBaseApp(name, log.NewNopLogger(), db, nil)

app.SetExtendVoteHandler(func(ctx sdk.Context, req *abci.RequestExtendVote) (*abci.ResponseExtendVote, error) {
voteExt := "foo" + hex.EncodeToString(req.Hash) + strconv.FormatInt(req.Height, 10)
Expand Down Expand Up @@ -369,7 +369,7 @@ func TestABCI_ExtendVote(t *testing.T) {
func TestABCI_OnlyVerifyVoteExtension(t *testing.T) {
name := t.Name()
db := dbm.NewMemDB()
app := baseapp.NewBaseApp(name, log.NewTestLogger(t), db, nil)
app := baseapp.NewBaseApp(name, log.NewNopLogger(), db, nil)

app.SetVerifyVoteExtensionHandler(func(ctx sdk.Context, req *abci.RequestVerifyVoteExtension) (*abci.ResponseVerifyVoteExtension, error) {
// do some kind of verification here
Expand Down Expand Up @@ -503,7 +503,7 @@ func TestABCI_P2PQuery(t *testing.T) {
func TestBaseApp_PrepareCheckState(t *testing.T) {
db := dbm.NewMemDB()
name := t.Name()
logger := log.NewTestLogger(t)
logger := log.NewNopLogger()

cp := &cmtproto.ConsensusParams{
Block: &cmtproto.BlockParams{
Expand Down Expand Up @@ -532,7 +532,7 @@ func TestBaseApp_PrepareCheckState(t *testing.T) {
func TestBaseApp_Precommit(t *testing.T) {
db := dbm.NewMemDB()
name := t.Name()
logger := log.NewTestLogger(t)
logger := log.NewNopLogger()

cp := &cmtproto.ConsensusParams{
Block: &cmtproto.BlockParams{
Expand Down Expand Up @@ -1238,7 +1238,7 @@ func TestABCI_Query(t *testing.T) {
}

func TestABCI_GetBlockRetentionHeight(t *testing.T) {
logger := log.NewTestLogger(t)
logger := log.NewNopLogger()
db := dbm.NewMemDB()
name := t.Name()

Expand Down Expand Up @@ -1351,7 +1351,7 @@ func TestABCI_GetBlockRetentionHeight(t *testing.T) {
func TestPrepareCheckStateCalledWithCheckState(t *testing.T) {
t.Parallel()

logger := log.NewTestLogger(t)
logger := log.NewNopLogger()
db := dbm.NewMemDB()
name := t.Name()
app := baseapp.NewBaseApp(name, logger, db, nil)
Expand All @@ -1374,7 +1374,7 @@ func TestPrepareCheckStateCalledWithCheckState(t *testing.T) {
func TestPrecommiterCalledWithDeliverState(t *testing.T) {
t.Parallel()

logger := log.NewTestLogger(t)
logger := log.NewNopLogger()
db := dbm.NewMemDB()
name := t.Name()
app := baseapp.NewBaseApp(name, logger, db, nil)
Expand Down Expand Up @@ -2009,7 +2009,7 @@ func TestABCI_HaltChain(t *testing.T) {
func TestBaseApp_PreFinalizeBlockHook(t *testing.T) {
db := dbm.NewMemDB()
name := t.Name()
logger := log.NewTestLogger(t)
logger := log.NewNopLogger()

app := baseapp.NewBaseApp(name, logger, db, nil)
_, err := app.InitChain(&abci.RequestInitChain{})
Expand Down
14 changes: 7 additions & 7 deletions baseapp/baseapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func NewBaseAppSuite(t *testing.T, opts ...func(*baseapp.BaseApp)) *BaseAppSuite
txConfig := authtx.NewTxConfig(cdc, authtx.DefaultSignModes)
db := dbm.NewMemDB()

app := baseapp.NewBaseApp(t.Name(), log.NewTestLogger(t), db, txConfig.TxDecoder(), opts...)
app := baseapp.NewBaseApp(t.Name(), log.NewNopLogger(), db, txConfig.TxDecoder(), opts...)
require.Equal(t, t.Name(), app.Name())

app.SetInterfaceRegistry(cdc.InterfaceRegistry())
Expand All @@ -91,7 +91,7 @@ func getQueryBaseapp(t *testing.T) *baseapp.BaseApp {

db := dbm.NewMemDB()
name := t.Name()
app := baseapp.NewBaseApp(name, log.NewTestLogger(t), db, nil)
app := baseapp.NewBaseApp(name, log.NewNopLogger(), db, nil)

_, err := app.FinalizeBlock(&abci.RequestFinalizeBlock{Height: 1})
require.NoError(t, err)
Expand Down Expand Up @@ -192,7 +192,7 @@ func NewBaseAppSuiteWithSnapshots(t *testing.T, cfg SnapshotsConfig, opts ...fun
}

func TestLoadVersion(t *testing.T) {
logger := log.NewTestLogger(t)
logger := log.NewNopLogger()
pruningOpt := baseapp.SetPruning(pruningtypes.NewPruningOptions(pruningtypes.PruningNothing))
db := dbm.NewMemDB()
name := t.Name()
Expand Down Expand Up @@ -323,7 +323,7 @@ func TestSetLoader(t *testing.T) {
if tc.setLoader != nil {
opts = append(opts, tc.setLoader)
}
app := baseapp.NewBaseApp(t.Name(), log.NewTestLogger(t), db, nil, opts...)
app := baseapp.NewBaseApp(t.Name(), log.NewNopLogger(), db, nil, opts...)
app.MountStores(storetypes.NewKVStoreKey(tc.loadStoreKey))
err := app.LoadLatestVersion()
require.Nil(t, err)
Expand All @@ -346,7 +346,7 @@ func TestVersionSetterGetter(t *testing.T) {
pruningOpt := baseapp.SetPruning(pruningtypes.NewPruningOptions(pruningtypes.PruningDefault))
db := dbm.NewMemDB()
name := t.Name()
app := baseapp.NewBaseApp(name, log.NewTestLogger(t), db, nil, pruningOpt)
app := baseapp.NewBaseApp(name, log.NewNopLogger(), db, nil, pruningOpt)

require.Equal(t, "", app.Version())
res, err := app.Query(context.TODO(), &abci.RequestQuery{Path: "app/version"})
Expand Down Expand Up @@ -405,7 +405,7 @@ func TestOptionFunction(t *testing.T) {
}

db := dbm.NewMemDB()
bap := baseapp.NewBaseApp("starting name", log.NewTestLogger(t), db, nil, testChangeNameHelper("new name"))
bap := baseapp.NewBaseApp("starting name", log.NewNopLogger(), db, nil, testChangeNameHelper("new name"))
require.Equal(t, bap.Name(), "new name", "BaseApp should have had name changed via option function")
}

Expand Down Expand Up @@ -597,7 +597,7 @@ func TestABCI_CreateQueryContext(t *testing.T) {

db := dbm.NewMemDB()
name := t.Name()
app := baseapp.NewBaseApp(name, log.NewTestLogger(t), db, nil)
app := baseapp.NewBaseApp(name, log.NewNopLogger(), db, nil)

_, err := app.FinalizeBlock(&abci.RequestFinalizeBlock{Height: 1})
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion baseapp/grpcrouter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestRegisterQueryServiceTwice(t *testing.T) {
err := depinject.Inject(
depinject.Configs(
makeMinimalConfig(),
depinject.Supply(log.NewTestLogger(t)),
depinject.Supply(log.NewNopLogger()),
),
&appBuilder)
require.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions baseapp/msg_service_router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestRegisterMsgService(t *testing.T) {
err := depinject.Inject(
depinject.Configs(
makeMinimalConfig(),
depinject.Supply(log.NewTestLogger(t)),
depinject.Supply(log.NewNopLogger()),
), &appBuilder, &registry)
require.NoError(t, err)
app := appBuilder.Build(dbm.NewMemDB(), nil)
Expand Down Expand Up @@ -62,7 +62,7 @@ func TestRegisterMsgServiceTwice(t *testing.T) {
err := depinject.Inject(
depinject.Configs(
makeMinimalConfig(),
depinject.Supply(log.NewTestLogger(t)),
depinject.Supply(log.NewNopLogger()),
), &appBuilder, &registry)
require.NoError(t, err)
db := dbm.NewMemDB()
Expand Down