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

test: unit and e2e tests to ibc-quota #1738

Merged
merged 112 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
6ed9e1f
WIP: add ibc rate limit middleware to ibc transfer
gsk967 Nov 7, 2022
4ce49c9
Merge main
gsk967 Nov 9, 2022
aada85f
WIP: add cll tx,query cmds
gsk967 Nov 9, 2022
08e3d08
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 10, 2022
16b50cd
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 11, 2022
57870ca
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 11, 2022
8412c70
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 12, 2022
9a4d380
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 12, 2022
28e2422
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 12, 2022
8e24765
WIP: add check rate limits for ibc denom
gsk967 Nov 14, 2022
4ad23eb
remove ibc-rate-limits and move rate limits into ibctransfer module
gsk967 Nov 14, 2022
9bf0109
move the umme ibctransfer into ics20 folder
gsk967 Nov 14, 2022
a87ff0d
fix: fix the lint
gsk967 Nov 14, 2022
bdeaec3
refactor: change the module structure to 'authz' type of cosmos-sdk
gsk967 Nov 15, 2022
aba25e0
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 15, 2022
7981d0d
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 16, 2022
37b15b3
remove inflow_limit in rate limits
gsk967 Nov 16, 2022
ea1316e
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 16, 2022
ac8381c
Merge remote-tracking branch 'origin/sai/ibc-rate-limit' into sai/ibc…
gsk967 Nov 16, 2022
a8206d3
chore: check the rate limits by exchange rate
gsk967 Nov 17, 2022
990db76
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 17, 2022
49c2bbb
add denom exponent to calculate amount in USD
gsk967 Nov 17, 2022
b5435b1
calculating the sent amount with exponent of registerd token
gsk967 Nov 17, 2022
3143115
fix: fix the amount calculation
gsk967 Nov 17, 2022
db358cf
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 17, 2022
0b30201
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 19, 2022
bce7a99
Merge main
gsk967 Nov 22, 2022
30bbdfc
fix: fix the rate-limit reset issue
gsk967 Nov 22, 2022
c2d0bc5
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 23, 2022
01ce260
refactor: update the params
gsk967 Nov 23, 2022
223f094
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 24, 2022
7b55068
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 28, 2022
c4b7de8
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 29, 2022
b27ff0d
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 5, 2022
e75b6f9
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 23, 2022
90f82b5
fix: fix the build
gsk967 Dec 23, 2022
47f09be
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 27, 2022
ff6239a
chore: update the limits and quota interval
gsk967 Dec 27, 2022
ecacc9e
chore: fix the lint issues
gsk967 Dec 27, 2022
6968250
chore: fix the lint issues
gsk967 Dec 27, 2022
0e2ef16
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 27, 2022
eea2115
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 29, 2022
be02147
chore: addree the pr comments
gsk967 Dec 29, 2022
e9a8717
chore: remove the param subspace from uibc
gsk967 Dec 29, 2022
be8bc11
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 30, 2022
267e958
refactor: refactor the proto and logic
gsk967 Dec 30, 2022
1aeb647
chore: address the pr comments
gsk967 Dec 30, 2022
b952683
fix: fix the buf lint
gsk967 Dec 30, 2022
1b119c7
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 2, 2023
1db2900
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 10, 2023
aa1daea
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 11, 2023
c5bfd75
chore: get the exchange price from TokenValue of leverage
gsk967 Jan 11, 2023
860795b
Merge remote-tracking branch 'origin/sai/ibc-rate-limit' into sai/ibc…
gsk967 Jan 11, 2023
b28f8f4
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 11, 2023
e485b2a
chore: convert uToken to baseToken in ibc-transfer quota checking
gsk967 Jan 11, 2023
3ae43d4
chore: add typed events for emit events
gsk967 Jan 12, 2023
f1d1e54
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 12, 2023
64600ef
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 16, 2023
4da6298
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 16, 2023
85e7486
address the review comments
gsk967 Jan 16, 2023
16e6488
refactor the code
gsk967 Jan 17, 2023
db8e103
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 17, 2023
a3f01de
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 18, 2023
07d05c5
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 23, 2023
14cdcd3
address the pr comments
gsk967 Jan 23, 2023
1dee0e7
chore: fix the build issue
gsk967 Jan 23, 2023
8f052ec
chore: add tests for params
gsk967 Jan 23, 2023
ef2acf4
add cli query test
gsk967 Jan 23, 2023
93cbbba
Merge branch 'main' into sai/ibc_quota_test
gsk967 Jan 23, 2023
0d71fd2
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 23, 2023
07fe9b4
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 24, 2023
e834de0
WIP: adding more tests
gsk967 Jan 24, 2023
1eda531
Merge remote-tracking branch 'origin/sai/ibc_quota_test' into sai/ibc…
gsk967 Jan 24, 2023
8f1cbe9
fix: fix the update quota params
gsk967 Jan 24, 2023
14c2558
Merge remote-tracking branch 'origin/sai/ibc-rate-limit' into sai/ibc…
gsk967 Jan 24, 2023
cf6507c
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 24, 2023
d5e92ae
add grpc tests and experimental unit test to workflows
gsk967 Jan 24, 2023
aef58c5
experimental unit test to git workflows
gsk967 Jan 24, 2023
a3c1e58
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 24, 2023
97ad447
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 24, 2023
0cfc87a
add quota test
gsk967 Jan 24, 2023
14badea
chore: address the pr comments
gsk967 Jan 24, 2023
1cbed41
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 24, 2023
78184a5
chore: fix the lint
gsk967 Jan 24, 2023
81123a5
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 24, 2023
22cc925
using assert from testtools
gsk967 Jan 24, 2023
e7ca80f
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 27, 2023
6e8cde5
address the pr comments++
gsk967 Jan 27, 2023
200e867
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 27, 2023
d558dc9
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 30, 2023
85f352d
address the pr comments
gsk967 Jan 30, 2023
b62b3db
address the pr comments
gsk967 Jan 30, 2023
9cc1660
Merge remote-tracking branch 'origin' into sai/ibc-rate-limit
gsk967 Jan 30, 2023
afcf52a
Merge remote-tracking branch 'origin/sai/ibc-rate-limit' into sai/ibc…
gsk967 Jan 30, 2023
16642e6
update reset quota
robert-zaremba Jan 30, 2023
f0ecf0a
move to Marshal to MustMarshal in uibc
gsk967 Jan 30, 2023
5fa2416
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 30, 2023
87d72ae
add TODO for ibc middleware acknowledgement
gsk967 Jan 30, 2023
8d178a2
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 30, 2023
8feec2a
add comment to outflow_sum
gsk967 Jan 30, 2023
f23c60b
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 30, 2023
8eb3b13
fix: fix the unit tests
gsk967 Jan 30, 2023
a438b15
merge main
gsk967 Jan 30, 2023
809e638
fix: fix the unit test
gsk967 Jan 30, 2023
2c09775
Merge branch 'main' into sai/ibc_quota_test
gsk967 Jan 31, 2023
d640a3a
Merge branch 'main' into sai/ibc_quota_test
gsk967 Jan 31, 2023
4ec2966
move from suite to gotest tools
gsk967 Jan 31, 2023
a28e70b
Merge branch 'main' into sai/ibc_quota_test
gsk967 Feb 1, 2023
97239b5
refactor the cli test
gsk967 Feb 1, 2023
c1957bf
++
gsk967 Feb 1, 2023
7ebca4a
fix the tests
gsk967 Feb 1, 2023
af5a02a
remove unused newmsg func
gsk967 Feb 2, 2023
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
21 changes: 21 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,24 @@ jobs:
run: |
sleep 1m
./contrib/scripts/test_localnet_liveness.sh 50 5 50 localhost:26657

experimental-test-unit:
runs-on: ubuntu-latest
needs: install-tparse
steps:
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6.1.2
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/setup-go@v3
if: env.GIT_DIFF
with:
go-version: 1.19
cache: true
- name: Test the experimental features
if: env.GIT_DIFF
run: |
EXPERIMENTAL=true make test-unit
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ test-unit-cover: ARGS=-timeout=10m -tags='$(UNIT_TEST_TAGS)' -coverprofile=$(TES
test-unit-cover: TEST_PACKAGES=$(PACKAGES_UNIT)
test-race: ARGS=-timeout=10m -race -tags='$(TEST_RACE_TAGS)'
test-race: TEST_PACKAGES=$(PACKAGES_UNIT)
test-e2e: ARGS=-timeout=25m -v --tags='$(TEST_E2E_TAGS)'
test-e2e: ARGS=-timeout=25m -v -tags='$(TEST_E2E_TAGS)'
gsk967 marked this conversation as resolved.
Show resolved Hide resolved
test-e2e: TEST_PACKAGES=$(PACKAGES_E2E)
$(TEST_TARGETS): run-tests

Expand Down
2 changes: 1 addition & 1 deletion ante/fee_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
bank "github.com/cosmos/cosmos-sdk/x/bank/types"
evidence "github.com/cosmos/cosmos-sdk/x/evidence/types"
"github.com/stretchr/testify/assert"
"gotest.tools/v3/assert"

leverage "github.com/umee-network/umee/v4/x/leverage/types"
)
Expand Down
10 changes: 5 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ type UmeeApp struct {
LeverageKeeper leveragekeeper.Keeper
OracleKeeper oraclekeeper.Keeper
bech32IbcKeeper bech32ibckeeper.Keeper
uibcQuotaKeeper uibcquotakeeper.Keeper
UIbcQuotaKeeper uibcquotakeeper.Keeper

// make scoped keepers public for testing purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -508,12 +508,12 @@ func New(

var ics4Wrapper ibcporttypes.ICS4Wrapper
if Experimental {
app.uibcQuotaKeeper = uibcquotakeeper.NewKeeper(
app.UIbcQuotaKeeper = uibcquotakeeper.NewKeeper(
appCodec,
keys[uibc.StoreKey],
app.IBCKeeper.ChannelKeeper, app.LeverageKeeper,
)
ics4Wrapper = app.uibcQuotaKeeper
ics4Wrapper = app.UIbcQuotaKeeper
} else {
ics4Wrapper = app.IBCKeeper.ChannelKeeper
}
Expand Down Expand Up @@ -554,7 +554,7 @@ func New(
)

if Experimental {
transferStack = uibcquota.NewIBCMiddleware(transferStack, app.uibcQuotaKeeper)
transferStack = uibcquota.NewIBCMiddleware(transferStack, app.UIbcQuotaKeeper)
}

// Create IBC Router
Expand Down Expand Up @@ -647,7 +647,7 @@ func New(
appModules = append(
appModules,
wasm.NewAppModule(app.appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
uibcmodule.NewAppModule(appCodec, app.uibcQuotaKeeper),
uibcmodule.NewAppModule(appCodec, app.UIbcQuotaKeeper),
)
}

Expand Down
41 changes: 19 additions & 22 deletions x/oracle/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,25 @@ import (
const (
displayDenom string = appparams.DisplayDenom
bondDenom string = appparams.BondDenom
initialPower = int64(10000000000)
)

// Test addresses
var (
valPubKeys = simapp.CreateTestPubKeys(2)

valPubKey = valPubKeys[0]
pubKey = secp256k1.GenPrivKey().PubKey()
addr = sdk.AccAddress(pubKey.Address())
valAddr = sdk.ValAddress(pubKey.Address())

valPubKey2 = valPubKeys[1]
pubKey2 = secp256k1.GenPrivKey().PubKey()
addr2 = sdk.AccAddress(pubKey2.Address())
valAddr2 = sdk.ValAddress(pubKey2.Address())

initTokens = sdk.TokensFromConsensusPower(initialPower, sdk.DefaultPowerReduction)
initCoins = sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, initTokens))
)

type IntegrationTestSuite struct {
Expand All @@ -39,10 +58,6 @@ type IntegrationTestSuite struct {
msgServer types.MsgServer
}

const (
initialPower = int64(10000000000)
)

func (s *IntegrationTestSuite) SetupTest() {
require := s.Require()
isCheckTx := false
Expand Down Expand Up @@ -76,24 +91,6 @@ func (s *IntegrationTestSuite) SetupTest() {
s.msgServer = keeper.NewMsgServerImpl(app.OracleKeeper)
}

// Test addresses
var (
valPubKeys = simapp.CreateTestPubKeys(2)

valPubKey = valPubKeys[0]
pubKey = secp256k1.GenPrivKey().PubKey()
addr = sdk.AccAddress(pubKey.Address())
valAddr = sdk.ValAddress(pubKey.Address())

valPubKey2 = valPubKeys[1]
pubKey2 = secp256k1.GenPrivKey().PubKey()
addr2 = sdk.AccAddress(pubKey2.Address())
valAddr2 = sdk.ValAddress(pubKey2.Address())

initTokens = sdk.TokensFromConsensusPower(initialPower, sdk.DefaultPowerReduction)
initCoins = sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, initTokens))
)

// NewTestMsgCreateValidator test msg creator
func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey cryptotypes.PubKey, amt sdk.Int) *stakingtypes.MsgCreateValidator {
commission := stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec())
Expand Down
2 changes: 1 addition & 1 deletion x/uibc/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func GetCmdQueryParams() *cobra.Command {
cmd := &cobra.Command{
Use: "params",
Args: cobra.NoArgs,
Short: "Query the x/uibc module parameters",
Short: "Query the uibc module parameters",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
Expand Down
68 changes: 68 additions & 0 deletions x/uibc/client/tests/cli_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
//go:build experimental
// +build experimental

package tests

import (
"testing"

gravitytypes "github.com/Gravity-Bridge/Gravity-Bridge/module/x/gravity/types"
sdk "github.com/cosmos/cosmos-sdk/types"
umeeapp "github.com/umee-network/umee/v4/app"
"github.com/umee-network/umee/v4/x/uibc"
"gotest.tools/v3/assert"
)

func TestIntegrationSuite(t *testing.T) {
t.Parallel()
cfg := umeeapp.IntegrationTestNetworkConfig()
cfg.NumValidators = 2
cfg.Mnemonics = []string{
"empower ridge mystery shrimp predict alarm swear brick across funny vendor essay antique vote place lava proof gaze crush head east arch twin lady",
"clean target advice dirt onion correct original vibrant actor upon waste eternal color barely shrimp aspect fall material wait repeat bench demise length seven",
}

var gravityGenState gravitytypes.GenesisState
assert.NilError(t, cfg.Codec.UnmarshalJSON(cfg.GenesisState[gravitytypes.ModuleName], &gravityGenState))

gravityGenState.DelegateKeys = []gravitytypes.MsgSetOrchestratorAddress{
{
Validator: "umeevaloper1t3ass54lpra0klz047k0dax33ckahym5phdrpg",
Orchestrator: "umee1t3ass54lpra0klz047k0dax33ckahym5pn2vsz",
EthAddress: "0x9fc56f2e851e1ab2b4c0fc4f6344800f29652ffe",
},
{
Validator: "umeevaloper1kqh6nt4f48vptvq4j5cgr0nfd2x4z9ulvrtqrh",
Orchestrator: "umee1kqh6nt4f48vptvq4j5cgr0nfd2x4z9ulv8v0ja",
EthAddress: "0xddfda961410b2815b48679377baa0009ace173a2",
},
}

bz, err := cfg.Codec.MarshalJSON(&gravityGenState)
assert.NilError(t, err)
cfg.GenesisState[gravitytypes.ModuleName] = bz

var uibcGenState uibc.GenesisState
assert.NilError(t, cfg.Codec.UnmarshalJSON(cfg.GenesisState[uibc.ModuleName], &uibcGenState))
uibcGenState.Quotas = []uibc.Quota{
{
IbcDenom: "uumee",
OutflowSum: sdk.NewDec(10),
},
}
uibcGenState.TotalOutflowSum = sdk.NewDec(10)

bz, err = cfg.Codec.MarshalJSON(&uibcGenState)
assert.NilError(t, err)
cfg.GenesisState[uibc.ModuleName] = bz

// init the integration test and start the network
s := initIntegrationTestSuite(cfg, t)

// test cli queries
s.TestGetQuota(t)
s.TestQueryParams(t)

// tear down netowkr
tearDownSuite(s, t)
}
83 changes: 83 additions & 0 deletions x/uibc/client/tests/query.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//go:build experimental
gsk967 marked this conversation as resolved.
Show resolved Hide resolved
// +build experimental

package tests

import (
"fmt"
"testing"

clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
tmcli "github.com/tendermint/tendermint/libs/cli"
"gotest.tools/v3/assert"

"github.com/umee-network/umee/v4/x/uibc"
"github.com/umee-network/umee/v4/x/uibc/client/cli"
)

func (s *IntegrationTestSuite) TestQueryParams(t *testing.T) {
val := s.network.Validators[0]
clientCtx := val.ClientCtx

args := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
out, err := clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdQueryParams(), args)
assert.NilError(t, err)

var res uibc.QueryParamsResponse
assert.NilError(t, clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res))
assert.DeepEqual(t, res.Params, uibc.DefaultParams())
}

func (s *IntegrationTestSuite) TestGetQuota(t *testing.T) {
val := s.network.Validators[0]
clientCtx := val.ClientCtx

tests := []struct {
name string
args []string
errMsg string
noOfRecords int
}{
{
name: "Get ibc-transfer quota of all denoms",
args: []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
},
errMsg: "",
noOfRecords: 1,
},
{
name: "Get ibc-transfer quota of denom umee",
args: []string{
"uumee",
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
},
errMsg: "",
noOfRecords: 1,
},
{
name: "Get ibc-transfer quota of dummy denom ",
args: []string{
"dummy",
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
},
errMsg: "no quota for ibc denom",
noOfRecords: 0,
},
gsk967 marked this conversation as resolved.
Show resolved Hide resolved
}

for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
out, err := clitestutil.ExecTestCLICmd(clientCtx, cli.GetQuota(), tc.args)
if tc.errMsg == "" {
var res uibc.QueryQuotaResponse
assert.NilError(t, clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res))
assert.Equal(t, len(res.Quota), tc.noOfRecords)
} else {
assert.ErrorContains(t, err, tc.errMsg)
}
})
}
}
31 changes: 31 additions & 0 deletions x/uibc/client/tests/suite.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//go:build experimental
// +build experimental

package tests

import (
"testing"

"github.com/cosmos/cosmos-sdk/testutil/network"
"gotest.tools/v3/assert"
)

type IntegrationTestSuite struct {
cfg network.Config
network *network.Network
}

func initIntegrationTestSuite(cfg network.Config, t *testing.T) *IntegrationTestSuite {
var err error
t.Log("setting up integration test suite")
network, err := network.New(t, t.TempDir(), cfg)
assert.NilError(t, err)
_, err = network.WaitForHeight(1)
assert.NilError(t, err)
return &IntegrationTestSuite{cfg: cfg, network: network}
}

func tearDownSuite(s *IntegrationTestSuite, t *testing.T) {
t.Log("tearing down integration test suite")
s.network.Cleanup()
}
30 changes: 30 additions & 0 deletions x/uibc/genesis_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//go:build experimental
// +build experimental

package uibc

import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
"gotest.tools/v3/assert"
)

func TestGenesisValidation(t *testing.T) {
gs := DefaultGenesisState()
err := gs.Validate()
assert.NilError(t, err)
robert-zaremba marked this conversation as resolved.
Show resolved Hide resolved

gs.TotalOutflowSum = sdk.NewDec(-123123)
err = gs.Validate()
assert.ErrorContains(t, err, "total outflow sum shouldn't be negative")

gs.Quotas = []Quota{
{
IbcDenom: "umee",
OutflowSum: sdk.NewDec(-11123123),
},
}
err = gs.Validate()
assert.ErrorContains(t, err, "ibc denom quota expires shouldn't be empty")
}
Loading