Skip to content

Commit

Permalink
chore: rename integration to e2e (backport #291) (#298)
Browse files Browse the repository at this point in the history
* chore: rename `integration` to `e2e` (#291)

(cherry picked from commit 7e279c5)

# Conflicts:
#	Makefile
#	tests/e2e/block_sdk_e2e_test.go

* fix

---------

Co-authored-by: Alex Johnson <[email protected]>
  • Loading branch information
mergify[bot] and Alex Johnson authored Dec 13, 2023
1 parent 4f52943 commit abee981
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 60 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
go work init
make test
test-integration:
test-e2e:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
Expand All @@ -62,8 +62,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
35 changes: 22 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##
###############################################################################
Expand All @@ -116,25 +116,34 @@ 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/)

.PHONY: test test-integration
test-cover: tidy
@echo Running unit tests and creating coverage report...
@go test -mod=readonly -v -timeout 30m -coverprofile=$(COVER_FILE) -covermode=atomic $(shell go list ./... | grep -v tests/)
@sed -i '/.pb.go/d' $(COVER_FILE)
@sed -i '/.pulsar.go/d' $(COVER_FILE)
@sed -i '/.proto/d' $(COVER_FILE)
@sed -i '/.pb.gw.go/d' $(COVER_FILE)


.PHONY: test test-e2e test-cover

###############################################################################
### Protobuf ###
Expand Down
1 change: 1 addition & 0 deletions block/base/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package base

import (
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/skip-mev/block-sdk/block"
)

Expand Down
1 change: 1 addition & 0 deletions block/base/tx_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
3 changes: 2 additions & 1 deletion block/mocks/lane.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion block/mocks/lane_mempool.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion block/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ 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"
"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/testutils"
"github.com/stretchr/testify/require"
)

func TestGetTxDistribution(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions block/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions lanes/base/tx_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/skip-mev/block-sdk/testutils"
)

Expand Down
1 change: 1 addition & 0 deletions tests/app/lanes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package integration_test
package e2e_test

import (
"fmt"
Expand All @@ -11,7 +11,7 @@ import (
ictestutil "github.com/strangelove-ventures/interchaintest/v8/testutil"
"github.com/stretchr/testify/suite"

"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"
)

Expand All @@ -22,7 +22,7 @@ var (
denom = "stake"

image = ibc.DockerImage{
Repository: "block-sdk-integration",
Repository: "block-sdk-e2e",
Version: "latest",
UidGid: "1000:1000",
}
Expand Down Expand Up @@ -80,6 +80,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))
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package integration
package e2e

import (
"context"
Expand All @@ -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 (
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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())
Expand All @@ -115,15 +116,15 @@ 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)

// expect validate to pass
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)
Expand All @@ -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()

Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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()

Expand Down
Loading

0 comments on commit abee981

Please sign in to comment.