Skip to content

Commit

Permalink
refactor: enable Staking and Vesting tests and remove unused query fu…
Browse files Browse the repository at this point in the history
…nctions
  • Loading branch information
omarsy committed Jan 5, 2025
1 parent abe97bc commit b12b053
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 51 deletions.
41 changes: 18 additions & 23 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ import "fmt"
var (
runBankTest = true
runEncodeTest = true
runEvidenceTest = true
runFeeGrantTest = true
runGovTest = true
runIBCTest = true
runSlashingTest = true
runStakingAndDistributionTest = true
runVestingTest = true
runStakingAndDistributionTest = false
runVestingTest = false
runRestInterfacesTest = true
runLsmTest = true
runRateLimitTest = true
runTxExtensionsTest = true
)

func (s *IntegrationTestSuite) TestRestInterfaces() {
Expand Down Expand Up @@ -74,20 +69,20 @@ func (s *IntegrationTestSuite) TestSlashing() {
}

// todo add fee test with wrong denom order
// func (s *IntegrationTestSuite) TestStakingAndDistribution() {
// if !runStakingAndDistributionTest {
// s.T().Skip()
// }
// s.testStaking()
// s.testDistribution()
// }
func (s *IntegrationTestSuite) TestStakingAndDistribution() {
if !runStakingAndDistributionTest {
s.T().Skip()
}
s.testStaking()
s.testDistribution()
}

// func (s *IntegrationTestSuite) TestVesting() {
// if !runVestingTest {
// s.T().Skip()
// }
// chainAAPI := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
// s.testDelayedVestingAccount(chainAAPI)
// s.testContinuousVestingAccount(chainAAPI)
// // s.testPeriodicVestingAccount(chainAAPI) TODO: add back when v0.45 adds the missing CLI command.
// }
func (s *IntegrationTestSuite) TestVesting() {
if !runVestingTest {
s.T().Skip()
}
chainAAPI := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
s.testDelayedVestingAccount(chainAAPI)
s.testContinuousVestingAccount(chainAAPI)
// s.testPeriodicVestingAccount(chainAAPI) TODO: add back when v0.45 adds the missing CLI command.
}
28 changes: 0 additions & 28 deletions tests/e2e/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,34 +74,6 @@ func queryTeritoriAllBalances(endpoint, addr string) (sdk.Coins, error) {
return balancesResp.Balances, nil
}

func querySupplyOf(endpoint, denom string) (sdk.Coin, error) {
body, err := httpGet(fmt.Sprintf("%s/cosmos/bank/v1beta1/supply/by_denom?denom=%s", endpoint, denom))
if err != nil {
return sdk.Coin{}, fmt.Errorf("failed to execute HTTP request: %w", err)
}

var supplyOfResp banktypes.QuerySupplyOfResponse
if err := cdc.UnmarshalJSON(body, &supplyOfResp); err != nil {
return sdk.Coin{}, err
}

return supplyOfResp.Amount, nil
}

func queryStakingParams(endpoint string) (stakingtypes.QueryParamsResponse, error) {
body, err := httpGet(fmt.Sprintf("%s/cosmos/staking/v1beta1/params", endpoint))
if err != nil {
return stakingtypes.QueryParamsResponse{}, fmt.Errorf("failed to execute HTTP request: %w", err)
}

var params stakingtypes.QueryParamsResponse
if err := cdc.UnmarshalJSON(body, &params); err != nil {
return stakingtypes.QueryParamsResponse{}, err
}

return params, nil
}

func queryDelegation(endpoint string, validatorAddr string, delegatorAddr string) (stakingtypes.QueryDelegationResponse, error) {
var res stakingtypes.QueryDelegationResponse

Expand Down

0 comments on commit b12b053

Please sign in to comment.