test: migrate remaining e2e tests to integration tests (#22364)
Co-authored-by: Julien Robert <julien@rbrt.fr> Co-authored-by: Marko <marko@baricevic.me>
This commit is contained in:
co-authored by
Julien Robert
Marko
parent
fc5536a641
commit
e37d71ad24
@@ -3,9 +3,3 @@ test-integration:
|
||||
|
||||
test-integration-cov:
|
||||
go test ./integration/... -timeout 30m -coverpkg=../... -coverprofile=integration-profile.out -covermode=atomic
|
||||
|
||||
test-e2e:
|
||||
go test ./e2e/... -mod=readonly -timeout 30m -race -tags='e2e'
|
||||
|
||||
test-e2e-cov:
|
||||
go test ./e2e/... -mod=readonly -timeout 30m -race -tags='e2e' -coverpkg=../... -coverprofile=e2e-profile.out -covermode=atomic
|
||||
@@ -1,11 +0,0 @@
|
||||
package lockup
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
func TestE2ETestSuite(t *testing.T) {
|
||||
suite.Run(t, NewE2ETestSuite())
|
||||
}
|
||||
+1
-1
@@ -16,7 +16,7 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func (s *E2ETestSuite) TestContinuousLockingAccount() {
|
||||
func (s *IntegrationTestSuite) TestContinuousLockingAccount() {
|
||||
t := s.T()
|
||||
app := setupApp(t)
|
||||
currentTime := time.Now()
|
||||
+1
-1
@@ -16,7 +16,7 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func (s *E2ETestSuite) TestDelayedLockingAccount() {
|
||||
func (s *IntegrationTestSuite) TestDelayedLockingAccount() {
|
||||
t := s.T()
|
||||
app := setupApp(t)
|
||||
currentTime := time.Now()
|
||||
@@ -0,0 +1,11 @@
|
||||
package lockup
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
func TestIntegrationTestSuite(t *testing.T) {
|
||||
suite.Run(t, NewIntegrationTestSuite())
|
||||
}
|
||||
+1
-1
@@ -16,7 +16,7 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func (s *E2ETestSuite) TestPeriodicLockingAccount() {
|
||||
func (s *IntegrationTestSuite) TestPeriodicLockingAccount() {
|
||||
t := s.T()
|
||||
app := setupApp(t)
|
||||
currentTime := time.Now()
|
||||
+1
-1
@@ -16,7 +16,7 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func (s *E2ETestSuite) TestPermanentLockingAccount() {
|
||||
func (s *IntegrationTestSuite) TestPermanentLockingAccount() {
|
||||
t := s.T()
|
||||
app := setupApp(t)
|
||||
currentTime := time.Now()
|
||||
@@ -20,23 +20,23 @@ var (
|
||||
accOwner = sdk.AccAddress(ownerAddr)
|
||||
)
|
||||
|
||||
type E2ETestSuite struct {
|
||||
type IntegrationTestSuite struct {
|
||||
suite.Suite
|
||||
|
||||
app *simapp.SimApp
|
||||
}
|
||||
|
||||
func NewE2ETestSuite() *E2ETestSuite {
|
||||
return &E2ETestSuite{}
|
||||
func NewIntegrationTestSuite() *IntegrationTestSuite {
|
||||
return &IntegrationTestSuite{}
|
||||
}
|
||||
|
||||
func (s *E2ETestSuite) SetupSuite() {
|
||||
s.T().Log("setting up e2e test suite")
|
||||
func (s *IntegrationTestSuite) SetupSuite() {
|
||||
s.T().Log("setting up integration test suite")
|
||||
s.app = setupApp(s.T())
|
||||
}
|
||||
|
||||
func (s *E2ETestSuite) TearDownSuite() {
|
||||
s.T().Log("tearing down e2e test suite")
|
||||
func (s *IntegrationTestSuite) TearDownSuite() {
|
||||
s.T().Log("tearing down integration test suite")
|
||||
}
|
||||
|
||||
func setupApp(t *testing.T) *simapp.SimApp {
|
||||
@@ -45,21 +45,21 @@ func setupApp(t *testing.T) *simapp.SimApp {
|
||||
return app
|
||||
}
|
||||
|
||||
func (s *E2ETestSuite) executeTx(ctx sdk.Context, msg sdk.Msg, app *simapp.SimApp, accAddr, sender []byte) error {
|
||||
func (s *IntegrationTestSuite) executeTx(ctx sdk.Context, msg sdk.Msg, app *simapp.SimApp, accAddr, sender []byte) error {
|
||||
_, err := app.AccountsKeeper.Execute(ctx, accAddr, sender, msg, nil)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *E2ETestSuite) queryAcc(ctx sdk.Context, req sdk.Msg, app *simapp.SimApp, accAddr []byte) (transaction.Msg, error) {
|
||||
func (s *IntegrationTestSuite) queryAcc(ctx sdk.Context, req sdk.Msg, app *simapp.SimApp, accAddr []byte) (transaction.Msg, error) {
|
||||
resp, err := app.AccountsKeeper.Query(ctx, accAddr, req)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (s *E2ETestSuite) fundAccount(app *simapp.SimApp, ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) {
|
||||
func (s *IntegrationTestSuite) fundAccount(app *simapp.SimApp, ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) {
|
||||
require.NoError(s.T(), testutil.FundAccount(ctx, app.BankKeeper, addr, amt))
|
||||
}
|
||||
|
||||
func (s *E2ETestSuite) queryLockupAccInfo(ctx sdk.Context, app *simapp.SimApp, accAddr []byte) *types.QueryLockupAccountInfoResponse {
|
||||
func (s *IntegrationTestSuite) queryLockupAccInfo(ctx sdk.Context, app *simapp.SimApp, accAddr []byte) *types.QueryLockupAccountInfoResponse {
|
||||
req := &types.QueryLockupAccountInfoRequest{}
|
||||
resp, err := s.queryAcc(ctx, req, app, accAddr)
|
||||
require.NoError(s.T(), err)
|
||||
+4
-4
@@ -18,12 +18,12 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func TestE2ETestSuite(t *testing.T) {
|
||||
suite.Run(t, NewE2ETestSuite())
|
||||
func TestIntegrationTestSuite(t *testing.T) {
|
||||
suite.Run(t, NewIntegrationTestSuite())
|
||||
}
|
||||
|
||||
// TestSimpleSendProposal creates a multisig account with 1 member, sends a tx, votes and executes it.
|
||||
func (s *E2ETestSuite) TestSimpleSendProposal() {
|
||||
func (s *IntegrationTestSuite) TestSimpleSendProposal() {
|
||||
ctx := sdk.NewContext(s.app.CommitMultiStore(), false, s.app.Logger()).WithHeaderInfo(header.Info{
|
||||
Time: time.Now(),
|
||||
})
|
||||
@@ -110,7 +110,7 @@ func (s *E2ETestSuite) TestSimpleSendProposal() {
|
||||
|
||||
// TestConfigUpdate creates a multisig with 1 member, adds 2 more members and
|
||||
// changes the config to require 2/3 majority (also through a proposal).
|
||||
func (s *E2ETestSuite) TestConfigUpdate() {
|
||||
func (s *IntegrationTestSuite) TestConfigUpdate() {
|
||||
ctx := sdk.NewContext(s.app.CommitMultiStore(), false, s.app.Logger()).WithHeaderInfo(header.Info{
|
||||
Time: time.Now(),
|
||||
})
|
||||
+11
-11
@@ -18,7 +18,7 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
type E2ETestSuite struct {
|
||||
type IntegrationTestSuite struct {
|
||||
suite.Suite
|
||||
|
||||
app *simapp.SimApp
|
||||
@@ -26,11 +26,11 @@ type E2ETestSuite struct {
|
||||
membersAddr []string
|
||||
}
|
||||
|
||||
func NewE2ETestSuite() *E2ETestSuite {
|
||||
return &E2ETestSuite{}
|
||||
func NewIntegrationTestSuite() *IntegrationTestSuite {
|
||||
return &IntegrationTestSuite{}
|
||||
}
|
||||
|
||||
func (s *E2ETestSuite) SetupSuite() {
|
||||
func (s *IntegrationTestSuite) SetupSuite() {
|
||||
s.app = setupApp(s.T())
|
||||
|
||||
s.members = []sdk.AccAddress{}
|
||||
@@ -43,7 +43,7 @@ func (s *E2ETestSuite) SetupSuite() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *E2ETestSuite) TearDownSuite() {}
|
||||
func (s *IntegrationTestSuite) TearDownSuite() {}
|
||||
|
||||
func setupApp(t *testing.T) *simapp.SimApp {
|
||||
t.Helper()
|
||||
@@ -51,23 +51,23 @@ func setupApp(t *testing.T) *simapp.SimApp {
|
||||
return app
|
||||
}
|
||||
|
||||
func (s *E2ETestSuite) executeTx(ctx context.Context, msg sdk.Msg, accAddr, sender []byte) error {
|
||||
func (s *IntegrationTestSuite) executeTx(ctx context.Context, msg sdk.Msg, accAddr, sender []byte) error {
|
||||
_, err := s.app.AccountsKeeper.Execute(ctx, accAddr, sender, msg, nil)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *E2ETestSuite) queryAcc(ctx context.Context, req sdk.Msg, accAddr []byte) (transaction.Msg, error) {
|
||||
func (s *IntegrationTestSuite) queryAcc(ctx context.Context, req sdk.Msg, accAddr []byte) (transaction.Msg, error) {
|
||||
resp, err := s.app.AccountsKeeper.Query(ctx, accAddr, req)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (s *E2ETestSuite) fundAccount(ctx context.Context, addr sdk.AccAddress, amt sdk.Coins) {
|
||||
func (s *IntegrationTestSuite) fundAccount(ctx context.Context, addr sdk.AccAddress, amt sdk.Coins) {
|
||||
require.NoError(s.T(), testutil.FundAccount(ctx, s.app.BankKeeper, addr, amt))
|
||||
}
|
||||
|
||||
// initAccount initializes a multisig account with the given members and powers
|
||||
// and returns the account address
|
||||
func (s *E2ETestSuite) initAccount(ctx context.Context, sender []byte, membersPowers map[string]uint64) ([]byte, string) {
|
||||
func (s *IntegrationTestSuite) initAccount(ctx context.Context, sender []byte, membersPowers map[string]uint64) ([]byte, string) {
|
||||
s.fundAccount(ctx, sender, sdk.Coins{sdk.NewCoin("stake", math.NewInt(1000000))})
|
||||
|
||||
members := []*v1.Member{}
|
||||
@@ -95,7 +95,7 @@ func (s *E2ETestSuite) initAccount(ctx context.Context, sender []byte, membersPo
|
||||
}
|
||||
|
||||
// createProposal
|
||||
func (s *E2ETestSuite) createProposal(ctx context.Context, accAddr, sender []byte, msgs ...*codectypes.Any) {
|
||||
func (s *IntegrationTestSuite) createProposal(ctx context.Context, accAddr, sender []byte, msgs ...*codectypes.Any) {
|
||||
propReq := &v1.MsgCreateProposal{
|
||||
Proposal: &v1.Proposal{
|
||||
Title: "test",
|
||||
@@ -107,7 +107,7 @@ func (s *E2ETestSuite) createProposal(ctx context.Context, accAddr, sender []byt
|
||||
s.NoError(err)
|
||||
}
|
||||
|
||||
func (s *E2ETestSuite) executeProposal(ctx context.Context, accAddr, sender []byte, proposalID uint64) error {
|
||||
func (s *IntegrationTestSuite) executeProposal(ctx context.Context, accAddr, sender []byte, proposalID uint64) error {
|
||||
execReq := &v1.MsgExecuteProposal{
|
||||
ProposalId: proposalID,
|
||||
}
|
||||
+3
-2
@@ -1,16 +1,17 @@
|
||||
package keeper
|
||||
package keeper_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
authTest "github.com/cosmos/cosmos-sdk/tests/integration/auth/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/network"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
)
|
||||
|
||||
func TestAccountRetriever(t *testing.T) {
|
||||
cfg, err := network.DefaultConfigWithAppConfig(AppConfig)
|
||||
cfg, err := network.DefaultConfigWithAppConfig(authTest.AppConfig)
|
||||
require.NoError(t, err)
|
||||
cfg.NumValidators = 1
|
||||
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
package keeper
|
||||
package keeper_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"cosmossdk.io/depinject"
|
||||
"cosmossdk.io/log"
|
||||
|
||||
authTest "github.com/cosmos/cosmos-sdk/tests/integration/auth/keeper"
|
||||
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
@@ -19,7 +20,7 @@ func BenchmarkAccountMapperGetAccountFound(b *testing.B) {
|
||||
app, err := simtestutil.Setup(
|
||||
depinject.Configs(
|
||||
depinject.Supply(log.NewNopLogger()),
|
||||
AppConfig,
|
||||
authTest.AppConfig,
|
||||
),
|
||||
&accountKeeper,
|
||||
)
|
||||
@@ -48,7 +49,7 @@ func BenchmarkAccountMapperSetAccount(b *testing.B) {
|
||||
app, err := simtestutil.Setup(
|
||||
depinject.Configs(
|
||||
depinject.Supply(log.NewNopLogger()),
|
||||
AppConfig,
|
||||
authTest.AppConfig,
|
||||
), &accountKeeper)
|
||||
require.NoError(b, err)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package keeper
|
||||
package keeper_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"cosmossdk.io/depinject"
|
||||
"cosmossdk.io/log"
|
||||
|
||||
authTest "github.com/cosmos/cosmos-sdk/tests/integration/auth/keeper"
|
||||
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
@@ -17,7 +18,7 @@ func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
|
||||
var accountKeeper keeper.AccountKeeper
|
||||
app, err := simtestutil.SetupAtGenesis(
|
||||
depinject.Configs(
|
||||
AppConfig,
|
||||
authTest.AppConfig,
|
||||
depinject.Supply(log.NewNopLogger()),
|
||||
),
|
||||
&accountKeeper)
|
||||
@@ -1,4 +1,4 @@
|
||||
package tx_test
|
||||
package benchmark_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
authclient "github.com/cosmos/cosmos-sdk/x/auth/client"
|
||||
)
|
||||
|
||||
type E2EBenchmarkSuite struct {
|
||||
type TxBenchmarkSuite struct {
|
||||
cfg network.Config
|
||||
network network.NetworkI
|
||||
|
||||
@@ -29,7 +29,7 @@ type E2EBenchmarkSuite struct {
|
||||
queryClient tx.ServiceClient
|
||||
}
|
||||
|
||||
// BenchmarkTx is lifted from E2ETestSuite from this package, with irrelevant state checks removed.
|
||||
// BenchmarkTx is lifted from TestSuite from this package, with irrelevant state checks removed.
|
||||
//
|
||||
// Benchmark results:
|
||||
//
|
||||
@@ -41,7 +41,7 @@ type E2EBenchmarkSuite struct {
|
||||
//
|
||||
// BenchmarkTx-8 3772 301750 ns/op
|
||||
func BenchmarkTx(b *testing.B) {
|
||||
s := NewE2EBenchmarkSuite(b)
|
||||
s := NewTxBenchmarkSuite(b)
|
||||
b.Cleanup(s.Close)
|
||||
|
||||
val := s.network.GetValidators()[0]
|
||||
@@ -82,10 +82,10 @@ func BenchmarkTx(b *testing.B) {
|
||||
}
|
||||
}
|
||||
|
||||
func NewE2EBenchmarkSuite(tb testing.TB) *E2EBenchmarkSuite {
|
||||
func NewTxBenchmarkSuite(tb testing.TB) *TxBenchmarkSuite {
|
||||
tb.Helper()
|
||||
|
||||
s := new(E2EBenchmarkSuite)
|
||||
s := new(TxBenchmarkSuite)
|
||||
|
||||
cfg := network.DefaultConfig(simapp.NewTestNetworkFixture)
|
||||
cfg.NumValidators = 1
|
||||
@@ -151,11 +151,11 @@ func NewE2EBenchmarkSuite(tb testing.TB) *E2EBenchmarkSuite {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *E2EBenchmarkSuite) Close() {
|
||||
func (s *TxBenchmarkSuite) Close() {
|
||||
s.network.Cleanup()
|
||||
}
|
||||
|
||||
func mkTxBuilder(tb testing.TB, s *E2EBenchmarkSuite) client.TxBuilder {
|
||||
func mkTxBuilder(tb testing.TB, s *TxBenchmarkSuite) client.TxBuilder {
|
||||
tb.Helper()
|
||||
|
||||
val := s.network.GetValidators()[0]
|
||||
Reference in New Issue
Block a user