Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aljo242 committed May 15, 2024
1 parent 0212864 commit 79d5183
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 39 deletions.
15 changes: 8 additions & 7 deletions tests/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@ var (

// module account permissions
maccPerms = map[string][]string{
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
feemarkettypes.ModuleName: {authtypes.Burner},
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
feemarkettypes.ModuleName: {authtypes.Burner},
feemarkettypes.FeeCollectorName: {authtypes.Burner},
}
)

Expand Down
41 changes: 13 additions & 28 deletions tests/e2e/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"github.com/strangelove-ventures/interchaintest/v8/testutil"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
"golang.org/x/sync/errgroup"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

Expand Down Expand Up @@ -375,10 +374,14 @@ func (s *TestSuite) keyringDirFromNode() string {
}

// SendCoins creates a executes a SendCoins message and broadcasts the transaction.
func (s *TestSuite) SendCoins(ctx context.Context, chain *cosmos.CosmosChain, keyName, sender, receiver string, amt, fees sdk.Coins, gas int64) (string, error) {
func (s *TestSuite) SendCoins(ctx context.Context, keyName, sender, receiver string, amt, fees sdk.Coins, gas int64) (string, error) {
cc, ok := s.chain.(*cosmos.CosmosChain)
if !ok {
panic("unable to assert ibc.Chain as CosmosChain")
}
resp, err := s.ExecTx(
ctx,
chain,
cc,
keyName,
"bank",
"send",
Expand All @@ -401,7 +404,7 @@ func (s *TestSuite) GetAndFundTestUserWithMnemonic(
ctx context.Context,
keyNamePrefix, mnemonic string,
amount int64,
chain *cosmos.CosmosChain,
chain ibc.Chain,
) (ibc.Wallet, error) {
chainCfg := chain.Config()
keyName := fmt.Sprintf("%s-%s-%s", keyNamePrefix, chainCfg.ChainID, sample.AlphaString(r, 3))
Expand All @@ -412,7 +415,6 @@ func (s *TestSuite) GetAndFundTestUserWithMnemonic(

_, err = s.SendCoins(
ctx,
chain,
interchaintest.FaucetAccountKeyName,
interchaintest.FaucetAccountKeyName,
user.FormattedAddress(),
Expand All @@ -430,34 +432,17 @@ func (s *TestSuite) GetAndFundTestUsers(
ctx context.Context,
keyNamePrefix string,
amount int64,
chains ...*cosmos.CosmosChain,
) []ibc.Wallet {
users := make([]ibc.Wallet, len(chains))
var eg errgroup.Group
for i, chain := range chains {
i := i
chain := chain
eg.Go(func() error {
user, err := s.GetAndFundTestUserWithMnemonic(ctx, keyNamePrefix, "", amount, chain)
if err != nil {
return err
}
users[i] = user
return nil
})
}
s.Require().NoError(eg.Wait())
chain ibc.Chain,
) ibc.Wallet {
user, err := s.GetAndFundTestUserWithMnemonic(ctx, keyNamePrefix, "", amount, chain)
s.Require().NoError(err)

chainHeights := make([]testutil.ChainHeighter, len(chains))
for i := range chains {
chainHeights[i] = chains[i]
}
return users
return user
}

// ExecTx executes a cli command on a node, waits a block and queries the Tx to verify it was included on chain.
func (s *TestSuite) ExecTx(ctx context.Context, chain *cosmos.CosmosChain, keyName string, command ...string) (string, error) {
node := chain.FullNodes[0]
node := chain.Validators[0]

resp, err := node.ExecTx(ctx, keyName, command...)
s.Require().NoError(err)
Expand Down
7 changes: 3 additions & 4 deletions tests/e2e/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ func (s *TestSuite) SetupSuite() {
s.cdc = s.chain.Config().EncodingConfig.Codec

// get the users
s.user1 = s.GetAndFundTestUsers(ctx, s.T().Name(), initBalance, cc)[0]
s.user2 = s.GetAndFundTestUsers(ctx, s.T().Name(), initBalance, cc)[0]
s.user3 = s.GetAndFundTestUsers(ctx, s.T().Name(), initBalance, cc)[0]
s.user1 = s.GetAndFundTestUsers(ctx, s.T().Name(), initBalance, cc)
s.user2 = s.GetAndFundTestUsers(ctx, s.T().Name(), initBalance, cc)
s.user3 = s.GetAndFundTestUsers(ctx, s.T().Name(), initBalance, cc)

// create the broadcaster
s.T().Log("creating broadcaster")
Expand Down Expand Up @@ -172,7 +172,6 @@ func (s *TestSuite) TestSendTxUpdating() {
// send with the exact expected fee
txResp, err := s.SendCoins(
ctx,
cosmosChain,
s.user1.KeyName(),
s.user1.FormattedAddress(),
s.user2.FormattedAddress(),
Expand Down

0 comments on commit 79d5183

Please sign in to comment.