laconicd/tests/e2e/common.go
Prathamesh Musale 213c390c37
Some checks failed
Integration Tests / test-integration (push) Successful in 2m48s
E2E Tests / test-e2e (push) Successful in 4m56s
Lint / Run golangci-lint (push) Successful in 5m6s
Unit Tests / test-unit (push) Successful in 3m22s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 10m40s
SDK Tests / sdk_tests (push) Successful in 10m55s
SDK Tests / sdk_tests_auctions (push) Failing after 16m7s
Rename laconic2d to laconicd (#26)
Part of https://www.notion.so/Rename-laconic2d-to-laconicd-9028d0c020d24d1288e92ebcb773d7a7

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
Reviewed-on: cerc-io/laconic2d#26
Co-authored-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to>
Co-committed-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to>
2024-04-01 09:57:26 +00:00

70 lines
2.2 KiB
Go

package e2e
import (
"fmt"
"os"
"cosmossdk.io/log"
pruningtypes "cosmossdk.io/store/pruning/types"
dbm "github.com/cosmos/cosmos-db"
bam "github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client/flags"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
"github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/cosmos/cosmos-sdk/x/staking"
laconicApp "git.vdb.to/cerc-io/laconicd/app"
auctionmodule "git.vdb.to/cerc-io/laconicd/x/auction/module"
bondmodule "git.vdb.to/cerc-io/laconicd/x/bond/module"
registrymodule "git.vdb.to/cerc-io/laconicd/x/registry/module"
_ "git.vdb.to/cerc-io/laconicd/app/params" // import for side-effects (see init)
"git.vdb.to/cerc-io/laconicd/testutil/network"
)
// NewTestNetworkFixture returns a new LaconicApp AppConstructor for network simulation tests
func NewTestNetworkFixture() network.TestFixture {
dir, err := os.MkdirTemp("", "laconic")
if err != nil {
panic(fmt.Sprintf("failed creating temporary directory: %v", err))
}
defer os.RemoveAll(dir)
app, err := laconicApp.NewLaconicApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(dir))
if err != nil {
panic(fmt.Sprintf("failed to create laconic app: %v", err))
}
appCtr := func(val network.ValidatorI) servertypes.Application {
app, err := laconicApp.NewLaconicApp(
val.GetCtx().Logger, dbm.NewMemDB(), nil, true,
simtestutil.NewAppOptionsWithFlagHome(val.GetCtx().Config.RootDir),
bam.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)),
bam.SetMinGasPrices(val.GetAppConfig().MinGasPrices),
bam.SetChainID(val.GetCtx().Viper.GetString(flags.FlagChainID)),
)
if err != nil {
panic(fmt.Sprintf("failed creating temporary directory: %v", err))
}
return app
}
return network.TestFixture{
AppConstructor: appCtr,
GenesisState: app.DefaultGenesis(),
EncodingConfig: testutil.MakeTestEncodingConfig(
auth.AppModuleBasic{},
bank.AppModuleBasic{},
staking.AppModuleBasic{},
auctionmodule.AppModule{},
bondmodule.AppModule{},
registrymodule.AppModule{},
),
}
}