From 08bfeb63b3479269a871b55f278c060f249483a5 Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Tue, 4 Oct 2022 01:36:36 -0300 Subject: [PATCH 1/2] remove queries as `IntegrationTestSuite` to use as a static method --- tests/e2e/e2e_distribution_test.go | 2 +- tests/e2e/e2e_exec_test.go | 41 +++++- tests/e2e/e2e_groups_test.go | 14 +- tests/e2e/e2e_query_test.go | 209 ----------------------------- tests/e2e/query.go | 151 +++++++++++++++------ 5 files changed, 159 insertions(+), 258 deletions(-) delete mode 100644 tests/e2e/e2e_query_test.go diff --git a/tests/e2e/e2e_distribution_test.go b/tests/e2e/e2e_distribution_test.go index 2173a50096a..9b070bf0e06 100644 --- a/tests/e2e/e2e_distribution_test.go +++ b/tests/e2e/e2e_distribution_test.go @@ -22,7 +22,7 @@ func (s *IntegrationTestSuite) testDistribution( beforeBalance = sdk.NewCoin(uatomDenom, math.NewInt(0)) } - s.execSetWithrawAddress(s.chainA, 0, fees.String(), delegatorAddress, newWithdrawalAddress, homePath) + s.execSetWithdrawAddress(s.chainA, 0, fees.String(), delegatorAddress, newWithdrawalAddress, homePath) // Verify s.Require().Eventually( diff --git a/tests/e2e/e2e_exec_test.go b/tests/e2e/e2e_exec_test.go index 71b09b6ca04..4bfec29a487 100644 --- a/tests/e2e/e2e_exec_test.go +++ b/tests/e2e/e2e_exec_test.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "fmt" + "strconv" "strings" "time" @@ -481,7 +482,45 @@ func (s *IntegrationTestSuite) executeRedelegate(c *chain, valIdx int, amount, o s.T().Logf("%s successfully redelegated %s from %s to %s", delegatorAddr, amount, originalValOperAddress, newValOperAddress) } -func (s *IntegrationTestSuite) execSetWithrawAddress( +func (s *IntegrationTestSuite) getLatestBlockHeight(c *chain, valIdx int) int { + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + + type syncInfo struct { + SyncInfo struct { + LatestHeight string `json:"latest_block_height"` + } `json:"SyncInfo"` + } + + var currentHeight int + gaiaCommand := []string{gaiadBinary, "status"} + s.executeGaiaTxCommand(ctx, c, gaiaCommand, valIdx, func(stdOut []byte, stdErr []byte) bool { + var ( + err error + block syncInfo + ) + s.Require().NoError(json.Unmarshal(stdErr, &block)) + currentHeight, err = strconv.Atoi(block.SyncInfo.LatestHeight) + s.Require().NoError(err) + return currentHeight > 0 + }) + return currentHeight +} + +func (s *IntegrationTestSuite) verifyBalanceChange(endpoint string, expectedAmount sdk.Coin, recipientAddress string) { + s.Require().Eventually( + func() bool { + afterAtomBalance, err := getSpecificBalance(endpoint, recipientAddress, uatomDenom) + s.Require().NoError(err) + + return afterAtomBalance.IsEqual(expectedAmount) + }, + 20*time.Second, + 5*time.Second, + ) +} + +func (s *IntegrationTestSuite) execSetWithdrawAddress( c *chain, valIdx int, fees, diff --git a/tests/e2e/e2e_groups_test.go b/tests/e2e/e2e_groups_test.go index 291011f39ce..58f1f420f19 100644 --- a/tests/e2e/e2e_groups_test.go +++ b/tests/e2e/e2e_groups_test.go @@ -54,26 +54,26 @@ func (s *IntegrationTestSuite) GroupsSendMsgTest() { s.T().Logf("Creating Group") s.execCreateGroup(s.chainA, 0, adminAddr, "Cosmos Hub Group", filepath.Join(gaiaConfigPath, originalMembersFilename), fees.String()) - membersRes, err := s.queryGroupMembers(chainAAPIEndpoint, 1) + membersRes, err := queryGroupMembers(chainAAPIEndpoint, 1) s.Require().NoError(err) s.Assert().Equal(len(membersRes.Members), 3) s.T().Logf("Adding New Group Member") s.execUpdateGroupMembers(s.chainA, 0, adminAddr, strconv.Itoa(groupId), filepath.Join(gaiaConfigPath, addMemberFilename), fees.String()) - membersRes, err = s.queryGroupMembers(chainAAPIEndpoint, 1) + membersRes, err = queryGroupMembers(chainAAPIEndpoint, 1) s.Require().NoError(err) s.Assert().Equal(len(membersRes.Members), 4) s.T().Logf("Removing New Group Member") s.execUpdateGroupMembers(s.chainA, 0, adminAddr, strconv.Itoa(groupId), filepath.Join(gaiaConfigPath, removeMemberFilename), fees.String()) - membersRes, err = s.queryGroupMembers(chainAAPIEndpoint, 1) + membersRes, err = queryGroupMembers(chainAAPIEndpoint, 1) s.Require().NoError(err) s.Assert().Equal(len(membersRes.Members), 3) s.T().Logf("Creating Group Threshold Decision Policy") s.writeGroupPolicies(s.chainA, thresholdPolicyFilename, percentagePolicyFilename, thresholdPolicy, percentagePolicy) s.executeCreateGroupPolicy(s.chainA, 0, adminAddr, strconv.Itoa(groupId), thresholdPolicyMetadata, filepath.Join(gaiaConfigPath, thresholdPolicyFilename), fees.String()) - policies, err := s.queryGroupPolicies(chainAAPIEndpoint, groupId) + policies, err := queryGroupPolicies(chainAAPIEndpoint, groupId) s.Require().NoError(err) policy, err := getPolicy(policies.GroupPolicies, thresholdPolicyMetadata, groupId) s.Require().NoError(err) @@ -92,7 +92,7 @@ func (s *IntegrationTestSuite) GroupsSendMsgTest() { s.Require().Eventually( func() bool { - proposalRes, err := s.queryGroupProposal(chainAAPIEndpoint, 1) + proposalRes, err := queryGroupProposal(chainAAPIEndpoint, 1) s.Require().NoError(err) return proposalRes.Proposal.Status == group.PROPOSAL_STATUS_ACCEPTED @@ -109,7 +109,7 @@ func (s *IntegrationTestSuite) GroupsSendMsgTest() { proposalId++ s.T().Logf("Creating Group Percentage Decision Policy") s.executeCreateGroupPolicy(s.chainA, 0, adminAddr, strconv.Itoa(groupId), percentagePolicyMetadata, filepath.Join(gaiaConfigPath, percentagePolicyFilename), fees.String()) - policies, err = s.queryGroupPolicies(chainAAPIEndpoint, 1) + policies, err = queryGroupPolicies(chainAAPIEndpoint, 1) s.Require().NoError(err) policy, err = getPolicy(policies.GroupPolicies, percentagePolicyMetadata, 1) s.Require().NoError(err) @@ -124,7 +124,7 @@ func (s *IntegrationTestSuite) GroupsSendMsgTest() { s.Require().Eventually( func() bool { - proposalRes, err := s.queryGroupProposalByGroupPolicy(chainAAPIEndpoint, policy.Address) + proposalRes, err := queryGroupProposalByGroupPolicy(chainAAPIEndpoint, policy.Address) s.Require().NoError(err) return proposalRes.Proposals[0].Status == group.PROPOSAL_STATUS_REJECTED diff --git a/tests/e2e/e2e_query_test.go b/tests/e2e/e2e_query_test.go deleted file mode 100644 index f6ff92ed4b8..00000000000 --- a/tests/e2e/e2e_query_test.go +++ /dev/null @@ -1,209 +0,0 @@ -package e2e - -import ( - "context" - "encoding/json" - "fmt" - "io" - "net/http" - "strconv" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/cosmos-sdk/x/group" -) - -func (s *IntegrationTestSuite) queryGovProposal(endpoint string, proposalId uint64) (govv1beta1.QueryProposalResponse, error) { - var emptyProp govv1beta1.QueryProposalResponse - - path := fmt.Sprintf("%s/cosmos/gov/v1beta1/proposals/%d", endpoint, proposalId) - resp, err := http.Get(path) - if err != nil { - return emptyProp, fmt.Errorf("failed to execute HTTP request: %w", err) - } - defer resp.Body.Close() - - body, err := io.ReadAll(resp.Body) - if err != nil { - return emptyProp, err - } - var govProposalResp govv1beta1.QueryProposalResponse - - if err := cdc.UnmarshalJSON(body, &govProposalResp); err != nil { - return emptyProp, err - } - s.T().Logf("This is the gov response: %s", govProposalResp) - - return govProposalResp, nil -} - -func (s *IntegrationTestSuite) getLatestBlockHeight(c *chain, valIdx int) int { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - type syncInfo struct { - SyncInfo struct { - LatestHeight string `json:"latest_block_height"` - } `json:"SyncInfo"` - } - - var currentHeight int - gaiaCommand := []string{gaiadBinary, "status"} - s.executeGaiaTxCommand(ctx, c, gaiaCommand, valIdx, func(stdOut []byte, stdErr []byte) bool { - var ( - err error - block syncInfo - ) - s.Require().NoError(json.Unmarshal(stdErr, &block)) - currentHeight, err = strconv.Atoi(block.SyncInfo.LatestHeight) - s.Require().NoError(err) - return currentHeight > 0 - }) - return currentHeight -} - -func (s *IntegrationTestSuite) queryGroupMembers(endpoint string, groupId int) (group.QueryGroupMembersResponse, error) { - var res group.QueryGroupMembersResponse - path := fmt.Sprintf("%s/cosmos/group/v1/group_members/%d", endpoint, groupId) - - resp, err := http.Get(path) - if err != nil { - return res, fmt.Errorf("failed to execute HTTP request: %w", err) - } - defer resp.Body.Close() - - body, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - - if err := cdc.UnmarshalJSON(body, &res); err != nil { - return res, err - } - - return res, nil -} - -func (s *IntegrationTestSuite) queryGroupInfo(endpoint string, groupId int) (group.QueryGroupInfoResponse, error) { - var res group.QueryGroupInfoResponse - path := fmt.Sprintf("%s/cosmos/group/v1/group_info/%d", endpoint, groupId) - - resp, err := http.Get(path) - if err != nil { - return res, fmt.Errorf("failed to execute HTTP request: %w", err) - } - defer resp.Body.Close() - - body, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - - if err := cdc.UnmarshalJSON(body, &res); err != nil { - return res, err - } - - return res, nil -} - -func (s *IntegrationTestSuite) queryGroupsbyAdmin(endpoint string, adminAddress string) (group.QueryGroupsByAdminResponse, error) { - var res group.QueryGroupsByAdminResponse - path := fmt.Sprintf("%s/cosmos/group/v1/groups_by_admin/%s", endpoint, adminAddress) - - resp, err := http.Get(path) - if err != nil { - return res, fmt.Errorf("failed to execute HTTP request: %w", err) - } - defer resp.Body.Close() - - body, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - - if err := cdc.UnmarshalJSON(body, &res); err != nil { - return res, err - } - - return res, nil -} - -func (s *IntegrationTestSuite) queryGroupPolicies(endpoint string, groupId int) (group.QueryGroupPoliciesByGroupResponse, error) { - var res group.QueryGroupPoliciesByGroupResponse - path := fmt.Sprintf("%s/cosmos/group/v1/group_policies_by_group/%d", endpoint, groupId) - - resp, err := http.Get(path) - if err != nil { - return res, fmt.Errorf("failed to execute HTTP request: %w", err) - } - defer resp.Body.Close() - - body, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - - if err := cdc.UnmarshalJSON(body, &res); err != nil { - return res, err - } - - return res, nil -} - -func (s *IntegrationTestSuite) queryGroupProposal(endpoint string, groupId int) (group.QueryProposalResponse, error) { - var res group.QueryProposalResponse - path := fmt.Sprintf("%s/cosmos/group/v1/proposal/%d", endpoint, groupId) - - resp, err := http.Get(path) - if err != nil { - return res, fmt.Errorf("failed to execute HTTP request: %w", err) - } - defer resp.Body.Close() - - body, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - - if err := cdc.UnmarshalJSON(body, &res); err != nil { - return res, err - } - - return res, nil -} - -func (s *IntegrationTestSuite) queryGroupProposalByGroupPolicy(endpoint string, policyAddress string) (group.QueryProposalsByGroupPolicyResponse, error) { - var res group.QueryProposalsByGroupPolicyResponse - path := fmt.Sprintf("%s/cosmos/group/v1/proposals_by_group_policy/%s", endpoint, policyAddress) - - resp, err := http.Get(path) - if err != nil { - return res, fmt.Errorf("failed to execute HTTP request: %w", err) - } - defer resp.Body.Close() - - body, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - - if err := cdc.UnmarshalJSON(body, &res); err != nil { - return res, err - } - - return res, nil -} - -func (s *IntegrationTestSuite) verifyBalanceChange(endpoint string, expectedAmount sdk.Coin, recipientAddress string) { - s.Require().Eventually( - func() bool { - afterAtomBalance, err := getSpecificBalance(endpoint, recipientAddress, uatomDenom) - s.Require().NoError(err) - - return afterAtomBalance.IsEqual(expectedAmount) - }, - 20*time.Second, - 5*time.Second, - ) -} diff --git a/tests/e2e/query.go b/tests/e2e/query.go index 67ac82134f6..eeccb23d57a 100644 --- a/tests/e2e/query.go +++ b/tests/e2e/query.go @@ -11,6 +11,7 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/cosmos/cosmos-sdk/x/group" staketypes "github.com/cosmos/cosmos-sdk/x/staking/types" globalfee "github.com/cosmos/gaia/v8/x/globalfee/types" icamauth "github.com/cosmos/gaia/v8/x/icamauth/types" @@ -57,63 +58,27 @@ func getSpecificBalance(endpoint, addr, denom string) (amt sdk.Coin, err error) } func queryGaiaAllBalances(endpoint, addr string) (sdk.Coins, error) { - resp, err := http.Get(fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s", endpoint, addr)) + body, err := httpGet(fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s", endpoint, addr)) if err != nil { return nil, fmt.Errorf("failed to execute HTTP request: %w", err) } - defer resp.Body.Close() - - bz, err := io.ReadAll(resp.Body) - if err != nil { - return nil, err - } - var balancesResp banktypes.QueryAllBalancesResponse - if err := cdc.UnmarshalJSON(bz, &balancesResp); err != nil { + if err := cdc.UnmarshalJSON(body, &balancesResp); err != nil { return nil, err } return balancesResp.Balances, nil } -func queryGovProposal(endpoint string, proposalID int) (govv1beta1.QueryProposalResponse, error) { - var govProposalResp govv1beta1.QueryProposalResponse - - path := fmt.Sprintf("%s/cosmos/gov/v1beta1/proposals/%d", endpoint, proposalID) - - resp, err := http.Get(path) //nolint:gosec // this is only used during tests - if err != nil { - return govProposalResp, fmt.Errorf("failed to execute HTTP request: %w", err) - } - defer resp.Body.Close() - - body, err := io.ReadAll(resp.Body) - if err != nil { - return govProposalResp, err - } - - if err := cdc.UnmarshalJSON(body, &govProposalResp); err != nil { - return govProposalResp, err - } - - return govProposalResp, nil -} - func queryGlobalFees(endpoint string) (amt sdk.DecCoins, err error) { - resp, err := http.Get(fmt.Sprintf("%s/gaia/globalfee/v1beta1/minimum_gas_prices", endpoint)) + body, err := httpGet(fmt.Sprintf("%s/gaia/globalfee/v1beta1/minimum_gas_prices", endpoint)) if err != nil { return nil, fmt.Errorf("failed to execute HTTP request: %w", err) } - defer resp.Body.Close() - - bz, err := io.ReadAll(resp.Body) - if err != nil { - return nil, err - } var fees globalfee.QueryMinimumGasPricesResponse - if err := cdc.UnmarshalJSON(bz, &fees); err != nil { + if err := cdc.UnmarshalJSON(body, &fees); err != nil { return sdk.DecCoins{}, err } @@ -170,3 +135,109 @@ func queryDelegatorWithdrawalAddress(endpoint string, delegatorAddr string) (dis } return res, nil } + +func queryGroupMembers(endpoint string, groupId int) (group.QueryGroupMembersResponse, error) { + var res group.QueryGroupMembersResponse + path := fmt.Sprintf("%s/cosmos/group/v1/group_members/%d", endpoint, groupId) + + body, err := httpGet(path) + if err != nil { + return res, fmt.Errorf("failed to execute HTTP request: %w", err) + } + if err := cdc.UnmarshalJSON(body, &res); err != nil { + return res, err + } + + return res, nil +} + +func queryGroupInfo(endpoint string, groupId int) (group.QueryGroupInfoResponse, error) { + var res group.QueryGroupInfoResponse + path := fmt.Sprintf("%s/cosmos/group/v1/group_info/%d", endpoint, groupId) + + body, err := httpGet(path) + if err != nil { + return res, fmt.Errorf("failed to execute HTTP request: %w", err) + } + if err := cdc.UnmarshalJSON(body, &res); err != nil { + return res, err + } + + return res, nil +} + +func queryGroupsByAdmin(endpoint string, adminAddress string) (group.QueryGroupsByAdminResponse, error) { + var res group.QueryGroupsByAdminResponse + path := fmt.Sprintf("%s/cosmos/group/v1/groups_by_admin/%s", endpoint, adminAddress) + + body, err := httpGet(path) + if err != nil { + return res, fmt.Errorf("failed to execute HTTP request: %w", err) + } + if err := cdc.UnmarshalJSON(body, &res); err != nil { + return res, err + } + + return res, nil +} + +func queryGroupPolicies(endpoint string, groupId int) (group.QueryGroupPoliciesByGroupResponse, error) { + var res group.QueryGroupPoliciesByGroupResponse + path := fmt.Sprintf("%s/cosmos/group/v1/group_policies_by_group/%d", endpoint, groupId) + + body, err := httpGet(path) + if err != nil { + return res, fmt.Errorf("failed to execute HTTP request: %w", err) + } + if err := cdc.UnmarshalJSON(body, &res); err != nil { + return res, err + } + + return res, nil +} + +func queryGroupProposal(endpoint string, groupId int) (group.QueryProposalResponse, error) { + var res group.QueryProposalResponse + path := fmt.Sprintf("%s/cosmos/group/v1/proposal/%d", endpoint, groupId) + + body, err := httpGet(path) + if err != nil { + return res, fmt.Errorf("failed to execute HTTP request: %w", err) + } + if err := cdc.UnmarshalJSON(body, &res); err != nil { + return res, err + } + + return res, nil +} + +func queryGroupProposalByGroupPolicy(endpoint string, policyAddress string) (group.QueryProposalsByGroupPolicyResponse, error) { + var res group.QueryProposalsByGroupPolicyResponse + path := fmt.Sprintf("%s/cosmos/group/v1/proposals_by_group_policy/%s", endpoint, policyAddress) + + body, err := httpGet(path) + if err != nil { + return res, fmt.Errorf("failed to execute HTTP request: %w", err) + } + if err := cdc.UnmarshalJSON(body, &res); err != nil { + return res, err + } + + return res, nil +} + +func queryGovProposal(endpoint string, proposalID int) (govv1beta1.QueryProposalResponse, error) { + var govProposalResp govv1beta1.QueryProposalResponse + + path := fmt.Sprintf("%s/cosmos/gov/v1beta1/proposals/%d", endpoint, proposalID) + + body, err := httpGet(path) //nolint:gosec // this is only used during tests + if err != nil { + return govProposalResp, fmt.Errorf("failed to execute HTTP request: %w", err) + } + if err := cdc.UnmarshalJSON(body, &govProposalResp); err != nil { + return govProposalResp, err + } + + return govProposalResp, nil +} From 52f974375fff90147270562742eea0738cabc78b Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Tue, 4 Oct 2022 10:51:25 -0300 Subject: [PATCH 2/2] use module name as part of gaiad cli command --- tests/e2e/e2e_exec_test.go | 94 ++++++++++++++++++++----------------- tests/e2e/e2e_ibc_test.go | 4 +- tests/e2e/e2e_ica_test.go | 7 +-- tests/e2e/e2e_setup_test.go | 4 +- 4 files changed, 59 insertions(+), 50 deletions(-) diff --git a/tests/e2e/e2e_exec_test.go b/tests/e2e/e2e_exec_test.go index 4bfec29a487..7bb88089024 100644 --- a/tests/e2e/e2e_exec_test.go +++ b/tests/e2e/e2e_exec_test.go @@ -12,6 +12,12 @@ import ( "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + grouptypes "github.com/cosmos/cosmos-sdk/x/group" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + icamauth "github.com/cosmos/gaia/v8/x/icamauth/types" "github.com/ory/dockertest/v3/docker" ) @@ -23,8 +29,8 @@ func (s *IntegrationTestSuite) execBankSend(c *chain, valIdx int, from, to, amt, gaiaCommand := []string{ gaiadBinary, - "tx", - "bank", + txCommand, + banktypes.ModuleName, "send", from, to, @@ -46,8 +52,8 @@ func (s *IntegrationTestSuite) execWithdrawAllRewards(c *chain, valIdx int, paye gaiaCommand := []string{ gaiadBinary, - "tx", - "distribution", + txCommand, + distributiontypes.ModuleName, "withdraw-all-rewards", fmt.Sprintf("--%s=%s", flags.FlagFrom, payee), fmt.Sprintf("--%s=%s", flags.FlagGasPrices, fees), @@ -68,8 +74,8 @@ func (s *IntegrationTestSuite) execDistributionFundCommunityPool(c *chain, valId gaiaCommand := []string{ gaiadBinary, - "tx", - "distribution", + txCommand, + distributiontypes.ModuleName, "fund-community-pool", amt, fmt.Sprintf("--%s=%s", flags.FlagFrom, from), @@ -92,8 +98,8 @@ func (s *IntegrationTestSuite) execGovSubmitLegacyGovProposal(c *chain, valIdx i gaiaCommand := []string{ gaiadBinary, - "tx", - "gov", + txCommand, + govtypes.ModuleName, "submit-legacy-proposal", govProposalSubType, govProposalPath, @@ -117,8 +123,8 @@ func (s *IntegrationTestSuite) execGovDepositProposal(c *chain, valIdx int, subm gaiaCommand := []string{ gaiadBinary, - "tx", - "gov", + txCommand, + govtypes.ModuleName, "deposit", fmt.Sprintf("%d", proposalId), amount, @@ -142,8 +148,8 @@ func (s *IntegrationTestSuite) execGovVoteProposal(c *chain, valIdx int, submitt gaiaCommand := []string{ gaiadBinary, - "tx", - "gov", + txCommand, + govtypes.ModuleName, "vote", fmt.Sprintf("%d", proposalId), vote, @@ -167,8 +173,8 @@ func (s *IntegrationTestSuite) execGovWeightedVoteProposal(c *chain, valIdx int, gaiaCommand := []string{ gaiadBinary, - "tx", - "gov", + txCommand, + govtypes.ModuleName, "weighted-vote", fmt.Sprintf("%d", proposalId), vote, @@ -192,8 +198,8 @@ func (s *IntegrationTestSuite) execGovSubmitProposal(c *chain, valIdx int, submi gaiaCommand := []string{ gaiadBinary, - "tx", - "gov", + txCommand, + govtypes.ModuleName, "submit-proposal", govProposalPath, fmt.Sprintf("--%s=%s", flags.FlagFrom, submitterAddr), @@ -216,8 +222,8 @@ func (s *IntegrationTestSuite) execCreateGroup(c *chain, valIdx int, adminAddr, gaiaCommand := []string{ gaiadBinary, - "tx", - "group", + txCommand, + grouptypes.ModuleName, "create-group", adminAddr, metadata, @@ -241,8 +247,8 @@ func (s *IntegrationTestSuite) execUpdateGroupMembers(c *chain, valIdx int, admi gaiaCommand := []string{ gaiadBinary, - "tx", - "group", + txCommand, + grouptypes.ModuleName, "update-group-members", adminAddr, groupId, @@ -266,8 +272,8 @@ func (s *IntegrationTestSuite) executeCreateGroupPolicy(c *chain, valIdx int, ad gaiaCommand := []string{ gaiadBinary, - "tx", - "group", + txCommand, + grouptypes.ModuleName, "create-group-policy", adminAddr, groupId, @@ -292,8 +298,8 @@ func (s *IntegrationTestSuite) executeSubmitGroupProposal(c *chain, valIdx int, gaiaCommand := []string{ gaiadBinary, - "tx", - "group", + txCommand, + grouptypes.ModuleName, "submit-proposal", proposalPath, fmt.Sprintf("--%s=%s", flags.FlagGasPrices, fees), @@ -316,8 +322,8 @@ func (s *IntegrationTestSuite) executeVoteGroupProposal(c *chain, valIdx int, pr gaiaCommand := []string{ gaiadBinary, - "tx", - "group", + txCommand, + grouptypes.ModuleName, "vote", proposalId, voterAddress, @@ -342,8 +348,8 @@ func (s *IntegrationTestSuite) executeExecGroupProposal(c *chain, valIdx int, pr gaiaCommand := []string{ gaiadBinary, - "tx", - "group", + txCommand, + grouptypes.ModuleName, "exec", proposalId, fmt.Sprintf("--%s=%s", flags.FlagFrom, proposerAddress), @@ -366,8 +372,8 @@ func (s *IntegrationTestSuite) executeUpdateGroupAdmin(c *chain, valIdx int, adm gaiaCommand := []string{ gaiadBinary, - "tx", - "group", + txCommand, + grouptypes.ModuleName, "update-group-admin", admin, groupId, @@ -389,7 +395,7 @@ func (s *IntegrationTestSuite) executeGKeysAddCommand(c *chain, valIdx int, name gaiaCommand := []string{ gaiadBinary, - "keys", + keysCommand, "add", name, fmt.Sprintf("--%s=%s", flags.FlagHome, home), @@ -414,7 +420,7 @@ func (s *IntegrationTestSuite) executeKeysList(c *chain, valIdx int, home string gaiaCommand := []string{ gaiadBinary, - "keys", + keysCommand, "list", "--keyring-backend=test", fmt.Sprintf("--%s=%s", flags.FlagHome, home), @@ -434,8 +440,8 @@ func (s *IntegrationTestSuite) executeDelegate(c *chain, valIdx int, amount, val gaiaCommand := []string{ gaiadBinary, - "tx", - "staking", + txCommand, + stakingtypes.ModuleName, "delegate", valOperAddress, amount, @@ -462,8 +468,8 @@ func (s *IntegrationTestSuite) executeRedelegate(c *chain, valIdx int, amount, o gaiaCommand := []string{ gaiadBinary, - "tx", - "staking", + txCommand, + stakingtypes.ModuleName, "redelegate", originalValOperAddress, newValOperAddress, @@ -534,8 +540,8 @@ func (s *IntegrationTestSuite) execSetWithdrawAddress( s.T().Logf("Setting distribution withdrawal address on chain %s for %s to %s", c.id, delegatorAddress, newWithdrawalAddress) gaiaCommand := []string{ gaiadBinary, - "tx", - "distribution", + txCommand, + distributiontypes.ModuleName, "set-withdraw-addr", newWithdrawalAddress, fmt.Sprintf("--%s=%s", flags.FlagFrom, delegatorAddress), @@ -564,8 +570,8 @@ func (s *IntegrationTestSuite) execWithdrawReward( s.T().Logf("Withdrawing distribution rewards on chain %s for delegator %s from %s validator", c.id, delegatorAddress, validatorAddress) gaiaCommand := []string{ gaiadBinary, - "tx", - "distribution", + txCommand, + distributiontypes.ModuleName, "withdraw-rewards", validatorAddress, fmt.Sprintf("--%s=%s", flags.FlagFrom, delegatorAddress), @@ -593,8 +599,8 @@ func (s *IntegrationTestSuite) submitICAtx(owner, connectionID, txJsonPath strin submitTX := []string{ gaiadBinary, - "tx", - "icamauth", + txCommand, + icamauth.ModuleName, "submit", txJsonPath, fmt.Sprintf("--%s=%s", flags.FlagFrom, owner), @@ -622,8 +628,8 @@ func (s *IntegrationTestSuite) registerICA(owner, connectionID string) { registerICAcmd := []string{ gaiadBinary, - "tx", - "icamauth", + txCommand, + icamauth.ModuleName, "register", fmt.Sprintf("--%s=%s", flags.FlagFrom, owner), fmt.Sprintf("--%s=%s", "connection-id", connectionID), diff --git a/tests/e2e/e2e_ibc_test.go b/tests/e2e/e2e_ibc_test.go index d15dcb3070c..a22621fa480 100644 --- a/tests/e2e/e2e_ibc_test.go +++ b/tests/e2e/e2e_ibc_test.go @@ -122,7 +122,7 @@ func (s *IntegrationTestSuite) sendIBC(c *chain, valIdx int, sender, recipient, ibcCmd := []string{ gaiadBinary, - "tx", + txCommand, "ibc-transfer", "transfer", "transfer", @@ -199,7 +199,7 @@ func (s *IntegrationTestSuite) createChannel() { User: "root", Cmd: []string{ "hermes", - "tx", + txCommand, "chan-open-init", "--dst-chain", s.chainA.id, diff --git a/tests/e2e/e2e_ica_test.go b/tests/e2e/e2e_ica_test.go index c3d946a55ac..d601c7cee32 100644 --- a/tests/e2e/e2e_ica_test.go +++ b/tests/e2e/e2e_ica_test.go @@ -9,6 +9,7 @@ import ( "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) // TestICARegister must run before any other @@ -93,8 +94,8 @@ func (s *IntegrationTestSuite) TestICA_2_BankSend() { sendamt := sdk.NewCoin(uatomDenom, math.NewInt(100000)) txCmd := []string{ gaiadBinary, - "tx", - "bank", + txCommand, + banktypes.ModuleName, "send", ica, receiver, @@ -125,7 +126,7 @@ func (s *IntegrationTestSuite) TestICA_2_BankSend() { sendIBCamt := math.NewInt(10) icaIBCsendCmd := []string{ gaiadBinary, - "tx", + txCommand, "ibc-transfer", "transfer", "transfer", diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index 70e308527e9..f9b1ab7d66e 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -25,7 +25,7 @@ import ( genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" gov "github.com/cosmos/cosmos-sdk/x/gov/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - "github.com/cosmos/cosmos-sdk/x/group" + "github.com/cosmos/cosmos-sdk/x/group" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/cosmos/gaia/v8/app/params" ibcclienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" @@ -41,6 +41,8 @@ import ( const ( gaiadBinary = "gaiad" + txCommand = "tx" + keysCommand = "keys" gaiaHomePath = "/home/nonroot/.gaia" photonDenom = "photon" uatomDenom = "uatom"