Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(e2e): remove queries as IntegrationTestSuite object #1780

Merged
merged 3 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/e2e/e2e_distribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
41 changes: 40 additions & 1 deletion tests/e2e/e2e_exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"encoding/json"
"fmt"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -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,
Expand Down
14 changes: 7 additions & 7 deletions tests/e2e/e2e_groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down
209 changes: 0 additions & 209 deletions tests/e2e/e2e_query_test.go

This file was deleted.

Loading