feat: replace the cosmos-db usecases in the tests with core/testing (backport #21525) (#21720)

Co-authored-by: cool-developer <51834436+cool-develope@users.noreply.github.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
mergify[bot]
2024-09-13 20:18:05 +00:00
committed by GitHub
co-authored by cool-developer Julien Robert
parent 64beb97259
commit 150d17c3fc
84 changed files with 576 additions and 523 deletions
+4 -3
View File
@@ -5,11 +5,12 @@ import (
"testing"
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
dbm "github.com/cosmos/cosmos-db"
"github.com/stretchr/testify/require"
"gotest.tools/v3/assert"
"cosmossdk.io/core/header"
corestore "cosmossdk.io/core/store"
coretesting "cosmossdk.io/core/testing"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
sdkmath "cosmossdk.io/math"
@@ -122,7 +123,7 @@ func TestImportExportQueues(t *testing.T) {
assert.NilError(t, err)
s2 := suite{}
db := dbm.NewMemDB()
db := coretesting.NewMemDB()
conf2 := simtestutil.DefaultStartUpConfig()
conf2.DB = db
s2.app, err = simtestutil.SetupWithConfiguration(
@@ -188,7 +189,7 @@ func TestImportExportQueues(t *testing.T) {
assert.Assert(t, proposal2.Status == v1.StatusRejected)
}
func clearDB(t *testing.T, db *dbm.MemDB) {
func clearDB(t *testing.T, db corestore.KVStoreWithBatch) {
t.Helper()
iter, err := db.Iterator(nil, nil)
assert.NilError(t, err)
@@ -6,9 +6,9 @@ import (
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
dbm "github.com/cosmos/cosmos-db"
"gotest.tools/v3/assert"
coretesting "cosmossdk.io/core/testing"
"cosmossdk.io/log"
"cosmossdk.io/simapp"
@@ -16,7 +16,7 @@ import (
)
func TestRollback(t *testing.T) {
db := dbm.NewMemDB()
db := coretesting.NewMemDB()
options := simapp.SetupOptions{
Logger: log.NewNopLogger(),
DB: db,