Skip to content

Commit

Permalink
fix: e2e clean (#116)
Browse files Browse the repository at this point in the history
* fix

* ok

* nice

* fix

* beauty
  • Loading branch information
Alex Johnson authored Jun 12, 2024
1 parent 1252ec0 commit efbd10d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 79 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/cosmos/cosmos-sdk v0.50.7
github.com/pelletier/go-toml/v2 v2.2.2
github.com/skip-mev/chaintestutil v0.0.0-20240514161515-056d7ba45610
github.com/skip-mev/feemarket v1.0.0
github.com/skip-mev/feemarket v1.0.1
github.com/skip-mev/slinky v1.0.0
github.com/strangelove-ventures/interchaintest/v8 v8.4.0
github.com/stretchr/testify v1.9.0
Expand Down
104 changes: 26 additions & 78 deletions tests/e2e/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,56 +394,30 @@ func (s *TestSuite) TestSendTxDecrease() {
break

case <-time.After(100 * time.Millisecond):
wg := sync.WaitGroup{}
wg := &sync.WaitGroup{}
wg.Add(3)

go func() {
smallSend := func(wg *sync.WaitGroup, userA, userB ibc.Wallet) {
defer wg.Done()
txResp, err := s.SendCoinsMultiBroadcast(
context.Background(),
s.user1,
s.user2,
userA,
userB,
sdk.NewCoins(sdk.NewCoin(s.chain.Config().Denom, math.NewInt(sendAmt))),
minBaseFeeCoins,
gas,
s.txConfig.SmallSendsNum,
)
s.Require().NoError(err, txResp)
s.Require().Equal(uint32(0), txResp.CheckTx.Code, txResp.CheckTx)
s.Require().Equal(uint32(0), txResp.TxResult.Code, txResp.TxResult)
}()

go func() {
defer wg.Done()
txResp, err := s.SendCoinsMultiBroadcast(
context.Background(),
s.user3,
s.user2,
sdk.NewCoins(sdk.NewCoin(s.chain.Config().Denom, math.NewInt(sendAmt))),
minBaseFeeCoins,
gas,
s.txConfig.SmallSendsNum,
)
s.Require().NoError(err, txResp)
s.Require().Equal(uint32(0), txResp.CheckTx.Code, txResp.CheckTx)
s.Require().Equal(uint32(0), txResp.TxResult.Code, txResp.TxResult)
}()
if err != nil {
s.T().Log(err)
} else if txResp != nil && txResp.CheckTx.Code != 0 {
s.T().Log(txResp.CheckTx)
}
}

go func() {
defer wg.Done()
txResp, err := s.SendCoinsMultiBroadcast(
context.Background(),
s.user2,
s.user3,
sdk.NewCoins(sdk.NewCoin(s.chain.Config().Denom, math.NewInt(sendAmt))),
minBaseFeeCoins,
gas,
s.txConfig.SmallSendsNum,
)
s.Require().NoError(err, txResp)
s.Require().Equal(uint32(0), txResp.CheckTx.Code, txResp.CheckTx)
s.Require().Equal(uint32(0), txResp.TxResult.Code, txResp.TxResult)
}()
go smallSend(wg, s.user1, s.user2)
go smallSend(wg, s.user3, s.user2)
go smallSend(wg, s.user2, s.user1)

wg.Wait()
}
Expand Down Expand Up @@ -508,56 +482,30 @@ func (s *TestSuite) TestSendTxIncrease() {
// add headroom
minBaseFeeCoins := sdk.NewCoins(sdk.NewCoin(minBaseFee.Denom, minBaseFee.Amount.Add(math.LegacyNewDec(10)).TruncateInt()))

wg := sync.WaitGroup{}
wg := &sync.WaitGroup{}
wg.Add(3)

go func() {
largeSend := func(wg *sync.WaitGroup, userA, userB ibc.Wallet) {
defer wg.Done()
txResp, err := s.SendCoinsMultiBroadcast(
context.Background(),
s.user1,
s.user2,
userA,
userB,
sdk.NewCoins(sdk.NewCoin(s.chain.Config().Denom, math.NewInt(sendAmt))),
minBaseFeeCoins,
gas,
s.txConfig.LargeSendsNum,
)
s.Require().NoError(err, txResp)
s.Require().Equal(uint32(0), txResp.CheckTx.Code, txResp.CheckTx)
s.Require().Equal(uint32(0), txResp.TxResult.Code, txResp.TxResult)
}()

go func() {
defer wg.Done()
txResp, err := s.SendCoinsMultiBroadcast(
context.Background(),
s.user3,
s.user2,
sdk.NewCoins(sdk.NewCoin(s.chain.Config().Denom, math.NewInt(sendAmt))),
minBaseFeeCoins,
gas,
s.txConfig.LargeSendsNum,
)
s.Require().NoError(err, txResp)
s.Require().Equal(uint32(0), txResp.CheckTx.Code, txResp.CheckTx)
s.Require().Equal(uint32(0), txResp.TxResult.Code, txResp.TxResult)
}()
if err != nil {
s.T().Log(err)
} else if txResp != nil && txResp.CheckTx.Code != 0 {
s.T().Log(txResp.CheckTx)
}
}

go func() {
defer wg.Done()
txResp, err := s.SendCoinsMultiBroadcast(
context.Background(),
s.user2,
s.user1,
sdk.NewCoins(sdk.NewCoin(s.chain.Config().Denom, math.NewInt(sendAmt))),
minBaseFeeCoins,
gas,
s.txConfig.LargeSendsNum,
)
s.Require().NoError(err, txResp)
s.Require().Equal(uint32(0), txResp.CheckTx.Code, txResp.CheckTx)
s.Require().Equal(uint32(0), txResp.TxResult.Code, txResp.TxResult)
}()
go largeSend(wg, s.user1, s.user2)
go largeSend(wg, s.user3, s.user2)
go largeSend(wg, s.user2, s.user1)

wg.Wait()
}
Expand Down

0 comments on commit efbd10d

Please sign in to comment.