chore: rename integration to e2e (#291)

This commit is contained in:
Alex Johnson
2023-12-12 16:23:15 -08:00
committed by GitHub
parent c09da7733b
commit 7e279c5daa
16 changed files with 68 additions and 60 deletions
+1
View File
@@ -2,6 +2,7 @@ package app
import (
"cosmossdk.io/math"
signerextraction "github.com/skip-mev/block-sdk/adapters/signer_extraction_adapter"
"github.com/skip-mev/block-sdk/block/base"
defaultlane "github.com/skip-mev/block-sdk/lanes/base"
@@ -1,4 +1,4 @@
package integration_test
package e2e_test
import (
"fmt"
@@ -16,7 +16,7 @@ import (
"github.com/skip-mev/block-sdk/lanes/base"
"github.com/skip-mev/block-sdk/lanes/free"
"github.com/skip-mev/block-sdk/lanes/mev"
"github.com/skip-mev/block-sdk/tests/integration"
"github.com/skip-mev/block-sdk/tests/e2e"
auctiontypes "github.com/skip-mev/block-sdk/x/auction/types"
blocksdkmoduletypes "github.com/skip-mev/block-sdk/x/blocksdk/types"
)
@@ -28,7 +28,7 @@ var (
denom = "stake"
image = ibc.DockerImage{
Repository: "block-sdk-integration",
Repository: "block-sdk-e2e",
Version: "latest",
UidGid: "1000:1000",
}
@@ -107,6 +107,6 @@ func MakeEncodingConfig() *testutil.TestEncodingConfig {
return &cfg
}
func TestIntegrationTestSuite(t *testing.T) {
suite.Run(t, integration.NewIntegrationTestSuiteFromSpec(spec))
func TestE2ETestSuite(t *testing.T) {
suite.Run(t, e2e.NewE2ETestSuiteFromSpec(spec))
}
@@ -1,4 +1,4 @@
package integration
package e2e
import (
"context"
@@ -12,13 +12,14 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/skip-mev/block-sdk/lanes/base"
"github.com/skip-mev/block-sdk/lanes/free"
interchaintest "github.com/strangelove-ventures/interchaintest/v8"
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"github.com/skip-mev/block-sdk/lanes/base"
"github.com/skip-mev/block-sdk/lanes/free"
)
const (
@@ -30,8 +31,8 @@ type committedTx struct {
res *rpctypes.ResultTx
}
// IntegrationTestSuite runs the Block SDK integration test-suite against a given interchaintest specification
type IntegrationTestSuite struct {
// E2ETestSuite runs the Block SDK e2e test-suite against a given interchaintest specification
type E2ETestSuite struct {
suite.Suite
// spec
spec *interchaintest.ChainSpec
@@ -53,14 +54,14 @@ type IntegrationTestSuite struct {
bc *cosmos.Broadcaster
}
func NewIntegrationTestSuiteFromSpec(spec *interchaintest.ChainSpec) *IntegrationTestSuite {
return &IntegrationTestSuite{
func NewE2ETestSuiteFromSpec(spec *interchaintest.ChainSpec) *E2ETestSuite {
return &E2ETestSuite{
spec: spec,
denom: "stake",
}
}
func (s *IntegrationTestSuite) WithDenom(denom string) *IntegrationTestSuite {
func (s *E2ETestSuite) WithDenom(denom string) *E2ETestSuite {
s.denom = denom
// update the bech32 prefixes
@@ -70,14 +71,14 @@ func (s *IntegrationTestSuite) WithDenom(denom string) *IntegrationTestSuite {
return s
}
func (s *IntegrationTestSuite) WithKeyringOptions(cdc codec.Codec, opts keyring.Option) {
func (s *E2ETestSuite) WithKeyringOptions(cdc codec.Codec, opts keyring.Option) {
s.broadcasterOverrides = &KeyringOverride{
cdc: cdc,
keyringOptions: opts,
}
}
func (s *IntegrationTestSuite) SetupSuite() {
func (s *E2ETestSuite) SetupSuite() {
// build the chain
s.T().Log("building chain with spec", s.spec)
s.chain = ChainBuilderFromChainSpec(s.T(), s.spec)
@@ -101,12 +102,12 @@ func (s *IntegrationTestSuite) SetupSuite() {
s.setupBroadcaster()
}
func (s *IntegrationTestSuite) TearDownSuite() {
func (s *E2ETestSuite) TearDownSuite() {
// close the interchain
s.ic.Close()
}
func (s *IntegrationTestSuite) SetupSubTest() {
func (s *E2ETestSuite) SetupSubTest() {
// wait for 1 block height
// query height
height, err := s.chain.(*cosmos.CosmosChain).Height(context.Background())
@@ -115,7 +116,7 @@ func (s *IntegrationTestSuite) SetupSubTest() {
s.T().Logf("reached height %d", height+2)
}
func (s *IntegrationTestSuite) TestQueryParams() {
func (s *E2ETestSuite) TestQueryParams() {
// query params
params := QueryAuctionParams(s.T(), s.chain)
@@ -123,7 +124,7 @@ func (s *IntegrationTestSuite) TestQueryParams() {
require.NoError(s.T(), params.Validate())
}
func (s *IntegrationTestSuite) TestMempoolService() {
func (s *E2ETestSuite) TestMempoolService() {
resp, err := QueryMempool(s.T(), s.chain)
s.Require().NoError(err)
s.Require().Len(resp.Distribution, 3)
@@ -136,7 +137,7 @@ func (s *IntegrationTestSuite) TestMempoolService() {
// 2. All transactions execute as expected.
// 3. The balance of the escrow account should be updated correctly.
// 4. Top of block bids will be included in block proposals before other transactions
func (s *IntegrationTestSuite) TestValidBids() {
func (s *E2ETestSuite) TestValidBids() {
params := QueryAuctionParams(s.T(), s.chain)
escrowAddr := sdk.AccAddress(params.EscrowAccountAddress).String()
@@ -383,7 +384,7 @@ func (s *IntegrationTestSuite) TestValidBids() {
// that are included in the same block.
// 5. If there is a block that has multiple valid bids with timeouts that are sufficiently far apart,
// the bids should be executed respecting the highest bids until the timeout is reached.
func (s *IntegrationTestSuite) TestMultipleBids() {
func (s *E2ETestSuite) TestMultipleBids() {
params := QueryAuctionParams(s.T(), s.chain)
escrowAddr := sdk.AccAddress(params.EscrowAccountAddress).String()
@@ -515,7 +516,7 @@ func (s *IntegrationTestSuite) TestMultipleBids() {
})
}
func (s *IntegrationTestSuite) TestInvalidBids() {
func (s *E2ETestSuite) TestInvalidBids() {
params := QueryAuctionParams(s.T(), s.chain)
s.Run("searcher is attempting to submit a bundle that includes another bid tx", func() {
@@ -853,7 +854,7 @@ func (s *IntegrationTestSuite) TestInvalidBids() {
//
// 1. Transactions that qualify as free should not be deducted any fees.
// 2. Transactions that do not qualify as free should be deducted the correct fees.
func (s *IntegrationTestSuite) TestFreeLane() {
func (s *E2ETestSuite) TestFreeLane() {
validators := QueryValidators(s.T(), s.chain.(*cosmos.CosmosChain))
require.True(s.T(), len(validators) > 0)
@@ -977,7 +978,7 @@ func (s *IntegrationTestSuite) TestFreeLane() {
})
}
func (s *IntegrationTestSuite) TestLanes() {
func (s *E2ETestSuite) TestLanes() {
validators := QueryValidators(s.T(), s.chain.(*cosmos.CosmosChain))
require.True(s.T(), len(validators) > 0)
@@ -1276,7 +1277,7 @@ func (s *IntegrationTestSuite) TestLanes() {
})
}
func (s *IntegrationTestSuite) TestNetwork() {
func (s *E2ETestSuite) TestNetwork() {
amountToTest := time.NewTicker(time.Second * 30)
defer amountToTest.Stop()
@@ -1,4 +1,4 @@
package integration
package e2e
import (
"archive/tar"
@@ -90,7 +90,7 @@ func BuildInterchain(t *testing.T, ctx context.Context, chain ibc.Chain) *interc
}
// CreateTx creates a new transaction to be signed by the given user, including a provided set of messages
func (s *IntegrationTestSuite) CreateTx(ctx context.Context, chain *cosmos.CosmosChain, user cosmos.User, seqIncrement, height uint64, GasPrice int64, msgs ...sdk.Msg) []byte {
func (s *E2ETestSuite) CreateTx(ctx context.Context, chain *cosmos.CosmosChain, user cosmos.User, seqIncrement, height uint64, GasPrice int64, msgs ...sdk.Msg) []byte {
// create tx factory + Client Context
txf, err := s.bc.GetFactory(ctx, user)
s.Require().NoError(err)
@@ -127,7 +127,7 @@ func (s *IntegrationTestSuite) CreateTx(ctx context.Context, chain *cosmos.Cosmo
return bz
}
func (s *IntegrationTestSuite) CreateDummyAuctionBidTx(
func (s *E2ETestSuite) CreateDummyAuctionBidTx(
height uint64,
searcher ibc.Wallet,
bid sdk.Coin,
@@ -148,7 +148,7 @@ func (s *IntegrationTestSuite) CreateDummyAuctionBidTx(
}
}
func (s *IntegrationTestSuite) CreateDummyNormalTx(
func (s *E2ETestSuite) CreateDummyNormalTx(
from, to ibc.Wallet,
coins sdk.Coins,
sequenceOffset uint64,
@@ -170,7 +170,7 @@ func (s *IntegrationTestSuite) CreateDummyNormalTx(
}
}
func (s *IntegrationTestSuite) CreateDummyFreeTx(
func (s *E2ETestSuite) CreateDummyFreeTx(
user ibc.Wallet,
validator sdk.ValAddress,
delegation sdk.Coin,
@@ -193,7 +193,7 @@ func (s *IntegrationTestSuite) CreateDummyFreeTx(
}
// SimulateTx simulates the provided messages, and checks whether the provided failure condition is met
func (s *IntegrationTestSuite) SimulateTx(ctx context.Context, chain *cosmos.CosmosChain, user cosmos.User, height uint64, expectFail bool, msgs ...sdk.Msg) {
func (s *E2ETestSuite) SimulateTx(ctx context.Context, chain *cosmos.CosmosChain, user cosmos.User, height uint64, expectFail bool, msgs ...sdk.Msg) {
// create tx factory + Client Context
txf, err := s.bc.GetFactory(ctx, user)
s.Require().NoError(err)
@@ -226,7 +226,7 @@ type Tx struct {
}
// CreateAuctionBidMsg creates a new AuctionBid tx signed by the given user, the order of txs in the MsgAuctionBid will be determined by the contents + order of the MessageForUsers
func (s *IntegrationTestSuite) CreateAuctionBidMsg(ctx context.Context, searcher cosmos.User, chain *cosmos.CosmosChain, bid sdk.Coin, txsPerUser []Tx) (*auctiontypes.MsgAuctionBid, [][]byte) {
func (s *E2ETestSuite) CreateAuctionBidMsg(ctx context.Context, searcher cosmos.User, chain *cosmos.CosmosChain, bid sdk.Coin, txsPerUser []Tx) (*auctiontypes.MsgAuctionBid, [][]byte) {
// for each MessagesForUser get the signed bytes
txs := make([][]byte, len(txsPerUser))
for i, tx := range txsPerUser {
@@ -248,7 +248,7 @@ func (s *IntegrationTestSuite) CreateAuctionBidMsg(ctx context.Context, searcher
// BroadcastTxs broadcasts the given messages for each user. This function returns the broadcasted txs. If a message
// is not expected to be included in a block, set SkipInclusionCheck to true and the method
// will not block on the tx's inclusion in a block, otherwise this method will block on the tx's inclusion
func (s *IntegrationTestSuite) BroadcastTxs(ctx context.Context, chain *cosmos.CosmosChain, txs []Tx) [][]byte {
func (s *E2ETestSuite) BroadcastTxs(ctx context.Context, chain *cosmos.CosmosChain, txs []Tx) [][]byte {
return s.BroadcastTxsWithCallback(ctx, chain, txs, nil)
}
@@ -256,7 +256,7 @@ func (s *IntegrationTestSuite) BroadcastTxs(ctx context.Context, chain *cosmos.C
// is not expected to be included in a block, set SkipInclusionCheck to true and the method
// will not block on the tx's inclusion in a block, otherwise this method will block on the tx's inclusion. The callback
// function is called for each tx that is included in a block.
func (s *IntegrationTestSuite) BroadcastTxsWithCallback(
func (s *E2ETestSuite) BroadcastTxsWithCallback(
ctx context.Context,
chain *cosmos.CosmosChain,
txs []Tx,
@@ -455,7 +455,7 @@ func TxHash(tx []byte) string {
return strings.ToUpper(hex.EncodeToString(comettypes.Tx(tx).Hash()))
}
func (s *IntegrationTestSuite) setupBroadcaster() {
func (s *E2ETestSuite) setupBroadcaster() {
bc := cosmos.NewBroadcaster(s.T(), s.chain.(*cosmos.CosmosChain))
if s.broadcasterOverrides == nil {
@@ -487,7 +487,7 @@ func (s *IntegrationTestSuite) setupBroadcaster() {
}
// sniped from here: https://github.com/strangelove-ventures/interchaintest ref: 9341b001214d26be420f1ca1ab0f15bad17faee6
func (s *IntegrationTestSuite) keyringDirFromNode() string {
func (s *E2ETestSuite) keyringDirFromNode() string {
node := s.chain.(*cosmos.CosmosChain).Nodes()[0]
// create a temp-dir
@@ -1,4 +1,4 @@
module github.com/skip-mev/block-sdk/tests/integration
module github.com/skip-mev/block-sdk/tests/e2e
go 1.21