@@ -11,7 +11,6 @@ import (
11
11
"time"
12
12
13
13
"github.com/cosmos/cosmos-sdk/codec"
14
- "github.com/cosmos/cosmos-sdk/crypto/keyring"
15
14
sdk "github.com/cosmos/cosmos-sdk/types"
16
15
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
17
16
interchaintest "github.com/strangelove-ventures/interchaintest/v9"
@@ -101,52 +100,7 @@ type TestSuite struct {
101
100
txConfig TestTxConfig
102
101
}
103
102
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 {
150
104
if err := txCfg .Validate (); err != nil {
151
105
panic (err )
152
106
}
@@ -161,20 +115,9 @@ func NewIntegrationSuite(spec *interchaintest.ChainSpec, txCfg TestTxConfig, opt
161
115
txConfig : txCfg ,
162
116
}
163
117
164
- for _ , opt := range opts {
165
- opt (suite )
166
- }
167
-
168
118
return suite
169
119
}
170
120
171
- func (s * TestSuite ) WithKeyringOptions (cdc codec.Codec , opts keyring.Option ) {
172
- s .broadcasterOverrides = & KeyringOverride {
173
- cdc : cdc ,
174
- keyringOptions : opts ,
175
- }
176
- }
177
-
178
121
func (s * TestSuite ) SetupSuite () {
179
122
// build the chain
180
123
s .T ().Log ("building chain with spec" , s .spec )
@@ -456,7 +399,7 @@ func (s *TestSuite) TestSendTxFailures() {
456
399
457
400
s .Run ("submit tx with no gas attached" , func () {
458
401
// send one tx with no gas or fee attached
459
- _ , err := s .SendCoinsMultiBroadcast (
402
+ resp , err := s .SendCoinsMultiBroadcast (
460
403
context .Background (),
461
404
s .user1 ,
462
405
s .user3 ,
@@ -466,10 +409,11 @@ func (s *TestSuite) TestSendTxFailures() {
466
409
1 ,
467
410
)
468
411
s .Require ().ErrorContains (err , "out of gas" )
412
+ s .Require ().Nil (resp )
469
413
})
470
414
471
415
s .Run ("submit tx with no fee" , func () {
472
- _ , err := s .SendCoinsMultiBroadcast (
416
+ resp , err := s .SendCoinsMultiBroadcast (
473
417
context .Background (),
474
418
s .user1 ,
475
419
s .user3 ,
@@ -479,13 +423,14 @@ func (s *TestSuite) TestSendTxFailures() {
479
423
1 ,
480
424
)
481
425
s .Require ().ErrorContains (err , "no fee coin provided" )
426
+ s .Require ().Nil (resp )
482
427
})
483
428
484
429
s .Run ("fail a tx that uses full balance in fee - fail tx" , func () {
485
430
balance := s .QueryBalance (s .user3 )
486
431
487
432
// send one tx with no gas or fee attached
488
- _ , err := s .SendCoinsMultiBroadcast (
433
+ resp , err := s .SendCoinsMultiBroadcast (
489
434
context .Background (),
490
435
s .user3 ,
491
436
s .user1 ,
@@ -495,6 +440,10 @@ func (s *TestSuite) TestSendTxFailures() {
495
440
1 ,
496
441
)
497
442
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" )
498
447
// ensure that balance is deducted for any tx passing checkTx
499
448
newBalance := s .QueryBalance (s .user3 )
500
449
s .Require ().True (newBalance .IsLT (balance ), fmt .Sprintf ("new balance: %d, original balance: %d" ,
@@ -520,9 +469,8 @@ func (s *TestSuite) TestSendTxFailures() {
520
469
)
521
470
s .Require ().NoError (err )
522
471
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 ))
526
474
s .Require ().Contains (txResp .TxResult .Log , "insufficient funds" )
527
475
528
476
// ensure that balance is deducted for any tx passing checkTx
@@ -538,7 +486,7 @@ func (s *TestSuite) TestSendTxFailures() {
538
486
539
487
s .Run ("submit a tx with fee greater than full balance - fail checktx" , func () {
540
488
balance := s .QueryBalance (s .user1 )
541
- _ , err := s .SendCoinsMultiBroadcast (
489
+ resp , err := s .SendCoinsMultiBroadcast (
542
490
context .Background (),
543
491
s .user1 ,
544
492
s .user3 ,
@@ -548,6 +496,7 @@ func (s *TestSuite) TestSendTxFailures() {
548
496
1 ,
549
497
)
550
498
s .Require ().ErrorContains (err , "error escrowing funds" )
499
+ s .Require ().Nil (resp )
551
500
552
501
// ensure that no balance is deducted for a tx failing checkTx
553
502
newBalance := s .QueryBalance (s .user1 )
0 commit comments