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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 68 additions and 60 deletions

View File

@ -45,7 +45,7 @@ jobs:
with:
files: cover.out
test-integration:
test-e2e:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
@ -71,8 +71,8 @@ jobs:
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
- name: Integration Tests
- name: E2E Tests
if: env.GIT_DIFF
run: |
go work init
make test-integration
make test-e2e

View File

@ -97,17 +97,17 @@ build-and-start-app: build-test-app
use-main:
go work edit -use .
go work edit -dropuse ./tests/integration
go work edit -dropuse ./tests/e2e
use-integration:
use-e2e:
go work edit -dropuse .
go work edit -use ./tests/integration
go work edit -use ./tests/e2e
tidy:
go mod tidy
gofmt -s -w ./
.PHONY: docker-build docker-build-integration
.PHONY: docker-build docker-build-e2e
###############################################################################
## Docker ##
###############################################################################
@ -116,20 +116,20 @@ docker-build: use-main
@echo "Building E2E Docker image..."
@DOCKER_BUILDKIT=1 docker build -t skip-mev/block-sdk-e2e -f contrib/images/block-sdk.e2e.Dockerfile .
docker-build-integration: use-main
@echo "Building integration-test Docker image..."
@DOCKER_BUILDKIT=1 docker build -t block-sdk-integration -f contrib/images/block-sdk.integration.Dockerfile .
docker-build-e2e: use-main
@echo "Building e2e-test Docker image..."
@DOCKER_BUILDKIT=1 docker build -t block-sdk-e2e -f contrib/images/block-sdk.e2e.Dockerfile .
###############################################################################
### Tests ###
###############################################################################
TEST_INTEGRATION_DEPS = docker-build-integration use-integration
TEST_INTEGRATION_TAGS = integration
TEST_E2E_DEPS = docker-build-e2e use-e2e
TEST_E2E_TAGS = e2e
test-integration: $(TEST_INTEGRATION_DEPS)
@ echo "Running integration tests..."
@go test ./tests/integration/block_sdk_integration_test.go -timeout 30m -p 1 -race -v -tags='$(TEST_INTEGRATION_TAGS)'
test-e2e: $(TEST_E2E_DEPS)
@ echo "Running e2e tests..."
@go test ./tests/e2e/block_sdk_e2e_test.go -timeout 30m -p 1 -race -v -tags='$(TEST_E2E_TAGS)'
test: use-main
@go test -v -race $(shell go list ./... | grep -v tests/)
@ -143,7 +143,7 @@ test-cover: tidy
@sed -i '/.pb.gw.go/d' $(COVER_FILE)
.PHONY: test test-integration
.PHONY: test test-e2e
###############################################################################
### Protobuf ###

View File

@ -2,6 +2,7 @@ package base
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/block-sdk/block"
)

View File

@ -7,6 +7,7 @@ import (
comettypes "github.com/cometbft/cometbft/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/block-sdk/block/utils"
)

View File

@ -261,7 +261,8 @@ func (_m *Lane) SetMaxBlockSpace(_a0 math.LegacyDec) {
func NewLane(t interface {
mock.TestingT
Cleanup(func())
}) *Lane {
},
) *Lane {
mock := &Lane{}
mock.Mock.Test(t)

View File

@ -133,7 +133,8 @@ func (_m *LaneMempool) Select(_a0 context.Context, _a1 [][]byte) mempool.Iterato
func NewLaneMempool(t interface {
mock.TestingT
Cleanup(func())
}) *LaneMempool {
},
) *LaneMempool {
mock := &LaneMempool{}
mock.Mock.Test(t)

View File

@ -8,6 +8,8 @@ import (
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"
"github.com/skip-mev/block-sdk/block"
"github.com/skip-mev/block-sdk/block/service"
"github.com/skip-mev/block-sdk/block/service/types"
@ -15,7 +17,6 @@ import (
"github.com/skip-mev/block-sdk/lanes/free"
"github.com/skip-mev/block-sdk/lanes/mev"
"github.com/skip-mev/block-sdk/testutils"
"github.com/stretchr/testify/require"
)
func TestGetTxDistribution(t *testing.T) {

View File

@ -8,6 +8,7 @@ import (
comettypes "github.com/cometbft/cometbft/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkmempool "github.com/cosmos/cosmos-sdk/types/mempool"
signerextraction "github.com/skip-mev/block-sdk/adapters/signer_extraction_adapter"
)

View File

@ -1,14 +1,13 @@
FROM golang:1.21-bullseye AS builder
WORKDIR /src/pob
WORKDIR /src/bsdk
COPY . .
RUN go mod tidy
RUN make build-test-app
RUN go mod tidy && make build-test-app
## Prepare the final clear binary
FROM ubuntu:rolling
EXPOSE 26656 26657 1317 9090 7171
COPY --from=builder /src/pob/build/* /usr/local/bin/
COPY --from=builder /src/bsdk/build/* /usr/local/bin/
RUN apt-get update && apt-get install ca-certificates -y

View File

@ -5,6 +5,7 @@ import (
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/block-sdk/testutils"
)

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"

View File

@ -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))
}

View File

@ -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()

View File

@ -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

View File

@ -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