Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
aljo242 committed Jun 11, 2024
1 parent c97ca87 commit 7e4a83c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
6 changes: 6 additions & 0 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,18 @@ var (
ModifyGenesis: cosmos.ModifyGenesis(genesisKV),
},
}

txCfg = e2e.TestTxConfig{
SmallSendsNum: 1,
LargeSendsNum: 400,
}
)

func TestE2ETestSuite(t *testing.T) {
s := e2e.NewIntegrationSuite(
spec,
oracleImage,
txCfg,
)

suite.Run(t, s)
Expand Down
35 changes: 28 additions & 7 deletions tests/e2e/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package e2e

import (
"context"
"fmt"
"math/rand"
"os"
"os/signal"
Expand Down Expand Up @@ -91,6 +92,19 @@ func GetOracleSideCar(node *cosmos.ChainNode) *cosmos.SidecarProcess {
return node.Sidecars[0]
}

type TestTxConfig struct {
SmallSendsNum int
LargeSendsNum int
}

func (tx *TestTxConfig) Validate() error {
if tx.SmallSendsNum < 1 || tx.LargeSendsNum < 1 {
return fmt.Errorf("sends num should be greater than 1")
}

return nil
}

// TestSuite runs the feemarket e2e test-suite against a given interchaintest specification
type TestSuite struct {
suite.Suite
Expand Down Expand Up @@ -131,6 +145,8 @@ type TestSuite struct {

// chain constructor
cc ChainConstructor

txConfig TestTxConfig
}

// Option is a function that modifies the TestSuite
Expand Down Expand Up @@ -178,7 +194,11 @@ func WithChainConstructor(cc ChainConstructor) Option {
}
}

func NewIntegrationSuite(spec *interchaintest.ChainSpec, oracleImage ibc.DockerImage, opts ...Option) *TestSuite {
func NewIntegrationSuite(spec *interchaintest.ChainSpec, oracleImage ibc.DockerImage, txCfg TestTxConfig, opts ...Option) *TestSuite {
if err := txCfg.Validate(); err != nil {
panic(err)
}

suite := &TestSuite{
spec: spec,
oracleConfig: DefaultOracleSidecar(oracleImage),
Expand All @@ -187,6 +207,7 @@ func NewIntegrationSuite(spec *interchaintest.ChainSpec, oracleImage ibc.DockerI
authority: authtypes.NewModuleAddress(govtypes.ModuleName),
icc: DefaultInterchainConstructor,
cc: DefaultChainConstructor,
txConfig: txCfg,
}

for _, opt := range opts {
Expand Down Expand Up @@ -355,7 +376,7 @@ func (s *TestSuite) TestSendTxDecrease() {
sdk.NewCoins(sdk.NewCoin(s.chain.Config().Denom, math.NewInt(sendAmt))),
minBaseFeeCoins,
gas,
1,
s.txConfig.SmallSendsNum,
)
s.Require().NoError(err, txResp)
s.Require().Equal(uint32(0), txResp.CheckTx.Code, txResp.CheckTx)
Expand All @@ -371,7 +392,7 @@ func (s *TestSuite) TestSendTxDecrease() {
sdk.NewCoins(sdk.NewCoin(s.chain.Config().Denom, math.NewInt(sendAmt))),
minBaseFeeCoins,
gas,
1,
s.txConfig.SmallSendsNum,
)
s.Require().NoError(err, txResp)
s.Require().Equal(uint32(0), txResp.CheckTx.Code, txResp.CheckTx)
Expand All @@ -387,7 +408,7 @@ func (s *TestSuite) TestSendTxDecrease() {
sdk.NewCoins(sdk.NewCoin(s.chain.Config().Denom, math.NewInt(sendAmt))),
minBaseFeeCoins,
gas,
1,
s.txConfig.SmallSendsNum,
)
s.Require().NoError(err, txResp)
s.Require().Equal(uint32(0), txResp.CheckTx.Code, txResp.CheckTx)
Expand Down Expand Up @@ -453,7 +474,7 @@ func (s *TestSuite) TestSendTxIncrease() {
sdk.NewCoins(sdk.NewCoin(s.chain.Config().Denom, math.NewInt(sendAmt))),
minBaseFeeCoins,
gas,
400,
s.txConfig.LargeSendsNum,
)
s.Require().NoError(err, txResp)
s.Require().Equal(uint32(0), txResp.CheckTx.Code, txResp.CheckTx)
Expand All @@ -469,7 +490,7 @@ func (s *TestSuite) TestSendTxIncrease() {
sdk.NewCoins(sdk.NewCoin(s.chain.Config().Denom, math.NewInt(sendAmt))),
minBaseFeeCoins,
gas,
400,
s.txConfig.LargeSendsNum,
)
s.Require().NoError(err, txResp)
s.Require().Equal(uint32(0), txResp.CheckTx.Code, txResp.CheckTx)
Expand All @@ -485,7 +506,7 @@ func (s *TestSuite) TestSendTxIncrease() {
sdk.NewCoins(sdk.NewCoin(s.chain.Config().Denom, math.NewInt(sendAmt))),
minBaseFeeCoins,
gas,
400,
s.txConfig.LargeSendsNum,
)
s.Require().NoError(err, txResp)
s.Require().Equal(uint32(0), txResp.CheckTx.Code, txResp.CheckTx)
Expand Down

0 comments on commit 7e4a83c

Please sign in to comment.