Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
COMMIT := $(shell git log -1 --format='%H')
BINDIR ?= $(GOPATH)/bin
APP = ./app
LATEST_UPGRADE = $(shell ls -d ./app/upgrades/* | sort -r | head -n 1)

# Upgrade testsuite values
LATEST_UPGRADE ?= $(shell ls -d ./app/upgrades/* | sort -r | head -n 1)
SNAPSHOT_DIR ?= .exrpd
# don't override user values
ifeq (,$(VERSION))
VERSION := $(shell git describe --tags)
Expand Down Expand Up @@ -129,10 +131,10 @@ mocks:

test: test-poa test-integration test-sim-benchmark-simulation test-sim-full-app-fast

test-latest-upgrade:
@echo "--> Running upgrade testsuite"
test-upgrade:
@echo "--> Running upgrade testsuite from snapshot: $(SNAPSHOT_DIR), into $(LATEST_UPGRADE)"
@rm -rf $(LATEST_UPGRADE)/integration/.exrpd
@cp -r ./.exrpd $(LATEST_UPGRADE)/integration/.exrpd
@cp -r $(SNAPSHOT_DIR) $(LATEST_UPGRADE)/integration/.exrpd
@go test -mod=readonly -v $(LATEST_UPGRADE)/integration

test-integration:
Expand Down
79 changes: 0 additions & 79 deletions app/upgrades/v6/integration/network.go

This file was deleted.

34 changes: 0 additions & 34 deletions app/upgrades/v6/integration/suite.go

This file was deleted.

40 changes: 0 additions & 40 deletions app/upgrades/v6/integration/suite_test.go

This file was deleted.

44 changes: 44 additions & 0 deletions app/upgrades/v7/integration/auth_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//nolint:dupl
package integration

import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)

func (s *UpgradeTestSuite) TestUpgrade_Auth_Params() {
prevParams, err := s.network.GetAuthClient().Params(
s.network.GetContext(),
&authtypes.QueryParamsRequest{},
)
s.Require().NoError(err)

s.RunUpgrade(upgradeName)

postParams, err := s.network.GetAuthClient().Params(
s.network.GetContext(),
&authtypes.QueryParamsRequest{},
)
s.Require().NoError(err)

// Check that not modified params are the same
s.Require().Equal(prevParams.Params, postParams.Params)
}

func (s *UpgradeTestSuite) TestUpgrade_Auth_Accounts() {
res, err := s.network.GetAuthClient().Accounts(
s.network.GetContext(),
&authtypes.QueryAccountsRequest{},
)
s.Require().NoError(err)

s.RunUpgrade(upgradeName)

postRes, err := s.network.GetAuthClient().Accounts(
s.network.GetContext(),
&authtypes.QueryAccountsRequest{},
)
s.Require().NoError(err)

// Check that not modified accounts are the same
s.Require().Equal(res.Accounts, postRes.Accounts)
}
102 changes: 102 additions & 0 deletions app/upgrades/v7/integration/bank_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package integration

import (
sdktypes "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
)

func (s *UpgradeTestSuite) TestUpgrade_Bank_Params() {
prevParams, err := s.network.GetBankClient().Params(
s.network.GetContext(),
&banktypes.QueryParamsRequest{},
)
s.Require().NoError(err)

s.RunUpgrade(upgradeName)

postParams, err := s.network.GetBankClient().Params(
s.network.GetContext(),
&banktypes.QueryParamsRequest{},
)
s.Require().NoError(err)

// Check that not modified params are the same
s.Require().Equal(prevParams.Params, postParams.Params)
}

func (s *UpgradeTestSuite) TestUpgrade_Bank_TotalSupply() {
res, err := s.network.GetBankClient().TotalSupply(
s.network.GetContext(),
&banktypes.QueryTotalSupplyRequest{},
)
s.Require().NoError(err)

s.RunUpgrade(upgradeName)

postRes, err := s.network.GetBankClient().TotalSupply(
s.network.GetContext(),
&banktypes.QueryTotalSupplyRequest{},
)
s.Require().NoError(err)

// Check that not modified balances are the same
s.Require().Equal(res.Supply, postRes.Supply)
}

func (s *UpgradeTestSuite) TestUpgrade_Bank_Send() {
// Replace with the desired addresses
sender, err := sdktypes.AccAddressFromBech32("ethm1dakgyqjulg29m5fmv992g2y66m9g2mjn6hahwg")
s.Require().NoError(err)
receiver, err := sdktypes.AccAddressFromBech32("ethm1nqvn2hmte72e3z0xyqmh06hdwd9qu6hgdcavhh")
s.Require().NoError(err)
amount := sdktypes.NewInt64Coin(s.network.GetDenom(), 100)

prevBalancesSender, err := s.network.GetBankClient().Balance(
s.network.GetContext(),
&banktypes.QueryBalanceRequest{
Address: sender.String(),
Denom: s.network.GetDenom(),
},
)
s.Require().NoError(err)

prevBalancesReceiver, err := s.network.GetBankClient().Balance(
s.network.GetContext(),
&banktypes.QueryBalanceRequest{
Address: receiver.String(),
Denom: s.network.GetDenom(),
},
)
s.Require().NoError(err)

s.RunUpgrade(upgradeName)

err = s.network.BankKeeper().SendCoins(
s.network.GetContext(),
sender,
receiver,
sdktypes.NewCoins(amount),
)
s.Require().NoError(err)

postBalancesSender, err := s.network.GetBankClient().Balance(
s.network.GetContext(),
&banktypes.QueryBalanceRequest{
Address: sender.String(),
Denom: s.network.GetDenom(),
},
)
s.Require().NoError(err)

postBalancesReceiver, err := s.network.GetBankClient().Balance(
s.network.GetContext(),
&banktypes.QueryBalanceRequest{
Address: receiver.String(),
Denom: s.network.GetDenom(),
},
)
s.Require().NoError(err)

s.Require().Equal(prevBalancesSender.Balance.Amount.Sub(amount.Amount).String(), postBalancesSender.Balance.Amount.String())
s.Require().Equal(prevBalancesReceiver.Balance.Amount.Add(amount.Amount).String(), postBalancesReceiver.Balance.Amount.String())
}
24 changes: 24 additions & 0 deletions app/upgrades/v7/integration/distribution_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package integration

import (
distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
)

func (s *UpgradeTestSuite) TestUpgrade_DistributionParams() {
prevParams, err := s.network.GetDistrClient().Params(
s.network.GetContext(),
&distributiontypes.QueryParamsRequest{},
)
s.Require().NoError(err)

s.RunUpgrade(upgradeName)

postParams, err := s.network.GetDistrClient().Params(
s.network.GetContext(),
&distributiontypes.QueryParamsRequest{},
)
s.Require().NoError(err)

// Check that not modified params are the same
s.Require().Equal(prevParams.Params, postParams.Params)
}
Loading