Skip to content

Commit ab5451a

Browse files
committed
fixed
1 parent b3754bd commit ab5451a

File tree

2 files changed

+15
-66
lines changed

2 files changed

+15
-66
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ TEST_E2E_TAGS = e2e
124124

125125
test-e2e: $(TEST_E2E_DEPS)
126126
@echo "Running e2e tests..."
127-
@go test ./tests/e2e/e2e_test.go -timeout 30m -p 1 -race -v -tags='$(TEST_E2E_TAGS)'
127+
@go test ./tests/e2e/e2e_test.go -timeout 30m -p 1 -v -tags='$(TEST_E2E_TAGS)'
128128

129129
test-unit:
130130
@go test -v -race $(shell go list ./... | grep -v tests/)

tests/e2e/suite.go

Lines changed: 14 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"time"
1212

1313
"github.com/cosmos/cosmos-sdk/codec"
14-
"github.com/cosmos/cosmos-sdk/crypto/keyring"
1514
sdk "github.com/cosmos/cosmos-sdk/types"
1615
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
1716
interchaintest "github.com/strangelove-ventures/interchaintest/v9"
@@ -101,52 +100,7 @@ type TestSuite struct {
101100
txConfig TestTxConfig
102101
}
103102

104-
// Option is a function that modifies the TestSuite
105-
type Option func(*TestSuite)
106-
107-
// WithDenom sets the token denom
108-
func WithDenom(denom string) Option {
109-
return func(s *TestSuite) {
110-
s.denom = denom
111-
}
112-
}
113-
114-
// WithGasPrices sets gas prices.
115-
func WithGasPrices(gasPrices string) Option {
116-
return func(s *TestSuite) {
117-
s.gasPrices = gasPrices
118-
}
119-
}
120-
121-
// WithAuthority sets the authority address
122-
func WithAuthority(addr sdk.AccAddress) Option {
123-
return func(s *TestSuite) {
124-
s.authority = addr
125-
}
126-
}
127-
128-
// WithBlockTime sets the block time
129-
func WithBlockTime(t time.Duration) Option {
130-
return func(s *TestSuite) {
131-
s.blockTime = t
132-
}
133-
}
134-
135-
// WithInterchainConstructor sets the interchain constructor
136-
func WithInterchainConstructor(ic InterchainConstructor) Option {
137-
return func(s *TestSuite) {
138-
s.icc = ic
139-
}
140-
}
141-
142-
// WithChainConstructor sets the chain constructor
143-
func WithChainConstructor(cc ChainConstructor) Option {
144-
return func(s *TestSuite) {
145-
s.cc = cc
146-
}
147-
}
148-
149-
func NewIntegrationSuite(spec *interchaintest.ChainSpec, txCfg TestTxConfig, opts ...Option) *TestSuite {
103+
func NewIntegrationSuite(spec *interchaintest.ChainSpec, txCfg TestTxConfig) *TestSuite {
150104
if err := txCfg.Validate(); err != nil {
151105
panic(err)
152106
}
@@ -161,20 +115,9 @@ func NewIntegrationSuite(spec *interchaintest.ChainSpec, txCfg TestTxConfig, opt
161115
txConfig: txCfg,
162116
}
163117

164-
for _, opt := range opts {
165-
opt(suite)
166-
}
167-
168118
return suite
169119
}
170120

171-
func (s *TestSuite) WithKeyringOptions(cdc codec.Codec, opts keyring.Option) {
172-
s.broadcasterOverrides = &KeyringOverride{
173-
cdc: cdc,
174-
keyringOptions: opts,
175-
}
176-
}
177-
178121
func (s *TestSuite) SetupSuite() {
179122
// build the chain
180123
s.T().Log("building chain with spec", s.spec)
@@ -456,7 +399,7 @@ func (s *TestSuite) TestSendTxFailures() {
456399

457400
s.Run("submit tx with no gas attached", func() {
458401
// send one tx with no gas or fee attached
459-
_, err := s.SendCoinsMultiBroadcast(
402+
resp, err := s.SendCoinsMultiBroadcast(
460403
context.Background(),
461404
s.user1,
462405
s.user3,
@@ -466,10 +409,11 @@ func (s *TestSuite) TestSendTxFailures() {
466409
1,
467410
)
468411
s.Require().ErrorContains(err, "out of gas")
412+
s.Require().Nil(resp)
469413
})
470414

471415
s.Run("submit tx with no fee", func() {
472-
_, err := s.SendCoinsMultiBroadcast(
416+
resp, err := s.SendCoinsMultiBroadcast(
473417
context.Background(),
474418
s.user1,
475419
s.user3,
@@ -479,13 +423,14 @@ func (s *TestSuite) TestSendTxFailures() {
479423
1,
480424
)
481425
s.Require().ErrorContains(err, "no fee coin provided")
426+
s.Require().Nil(resp)
482427
})
483428

484429
s.Run("fail a tx that uses full balance in fee - fail tx", func() {
485430
balance := s.QueryBalance(s.user3)
486431

487432
// send one tx with no gas or fee attached
488-
_, err := s.SendCoinsMultiBroadcast(
433+
resp, err := s.SendCoinsMultiBroadcast(
489434
context.Background(),
490435
s.user3,
491436
s.user1,
@@ -495,6 +440,10 @@ func (s *TestSuite) TestSendTxFailures() {
495440
1,
496441
)
497442
s.Require().NoError(err)
443+
s.Require().NotNil(resp)
444+
s.Require().Equal(resp.CheckTx.Code, uint32(0))
445+
s.Require().Equal(resp.TxResult.Code, uint32(5))
446+
s.Require().Contains(resp.TxResult.Log, "insufficient funds")
498447
// ensure that balance is deducted for any tx passing checkTx
499448
newBalance := s.QueryBalance(s.user3)
500449
s.Require().True(newBalance.IsLT(balance), fmt.Sprintf("new balance: %d, original balance: %d",
@@ -520,9 +469,8 @@ func (s *TestSuite) TestSendTxFailures() {
520469
)
521470
s.Require().NoError(err)
522471
s.Require().NotNil(txResp)
523-
s.Require().True(txResp.CheckTx.Code == 0)
524-
s.Require().True(txResp.TxResult.Code != 0)
525-
s.T().Log(txResp.TxResult.Log)
472+
s.Require().Equal(txResp.CheckTx.Code, uint32(0))
473+
s.Require().NotEqual(txResp.TxResult.Code, uint32(0))
526474
s.Require().Contains(txResp.TxResult.Log, "insufficient funds")
527475

528476
// ensure that balance is deducted for any tx passing checkTx
@@ -538,7 +486,7 @@ func (s *TestSuite) TestSendTxFailures() {
538486

539487
s.Run("submit a tx with fee greater than full balance - fail checktx", func() {
540488
balance := s.QueryBalance(s.user1)
541-
_, err := s.SendCoinsMultiBroadcast(
489+
resp, err := s.SendCoinsMultiBroadcast(
542490
context.Background(),
543491
s.user1,
544492
s.user3,
@@ -548,6 +496,7 @@ func (s *TestSuite) TestSendTxFailures() {
548496
1,
549497
)
550498
s.Require().ErrorContains(err, "error escrowing funds")
499+
s.Require().Nil(resp)
551500

552501
// ensure that no balance is deducted for a tx failing checkTx
553502
newBalance := s.QueryBalance(s.user1)

0 commit comments

Comments
 (0)