chore: Remove testify from testdata package (#14575)
This commit is contained in:
@@ -178,6 +178,7 @@ require (
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gotest.tools/v3 v3.4.0 // indirect
|
||||
nhooyr.io/websocket v1.8.6 // indirect
|
||||
pgregory.net/rapid v0.5.5 // indirect
|
||||
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||
|
||||
@@ -1367,6 +1367,7 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o=
|
||||
gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g=
|
||||
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
||||
@@ -3,7 +3,6 @@ package keeper_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
"gotest.tools/v3/assert"
|
||||
"pgregory.net/rapid"
|
||||
@@ -102,7 +101,6 @@ func TestGRPCQueryBalance(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
addr := testdata.AddressGenerator(rt).Draw(rt, "address")
|
||||
coin := getCoin(rt)
|
||||
@@ -110,19 +108,18 @@ func TestGRPCQueryBalance(t *testing.T) {
|
||||
|
||||
req := banktypes.NewQueryBalanceRequest(addr, coin.GetDenom())
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.Balance, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.Balance, 0, true)
|
||||
})
|
||||
|
||||
fundAccount(f, addr1, coin1)
|
||||
req := banktypes.NewQueryBalanceRequest(addr1, coin1.GetDenom())
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.Balance, 1087, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.Balance, 1087, false)
|
||||
}
|
||||
|
||||
func TestGRPCQueryAllBalances(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
addr := testdata.AddressGenerator(rt).Draw(rt, "address")
|
||||
numCoins := rapid.IntRange(1, 10).Draw(rt, "num-count")
|
||||
@@ -138,7 +135,7 @@ func TestGRPCQueryAllBalances(t *testing.T) {
|
||||
fundAccount(f, addr, coins...)
|
||||
|
||||
req := banktypes.NewQueryAllBalancesRequest(addr, testdata.PaginationGenerator(rt, uint64(numCoins)).Draw(rt, "pagination"))
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.AllBalances, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.AllBalances, 0, true)
|
||||
})
|
||||
|
||||
coins := sdk.NewCoins(
|
||||
@@ -149,23 +146,22 @@ func TestGRPCQueryAllBalances(t *testing.T) {
|
||||
fundAccount(f, addr1, coins...)
|
||||
req := banktypes.NewQueryAllBalancesRequest(addr1, nil)
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.AllBalances, 357, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.AllBalances, 357, false)
|
||||
}
|
||||
|
||||
func TestGRPCQuerySpendableBalances(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(t *rapid.T) {
|
||||
addr := testdata.AddressGenerator(t).Draw(t, "address")
|
||||
numCoins := rapid.IntRange(1, 10).Draw(t, "num-count")
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
addr := testdata.AddressGenerator(rt).Draw(rt, "address")
|
||||
numCoins := rapid.IntRange(1, 10).Draw(rt, "num-count")
|
||||
coins := make(sdk.Coins, 0, numCoins)
|
||||
|
||||
for i := 0; i < numCoins; i++ {
|
||||
coin := sdk.NewCoin(
|
||||
rapid.StringMatching(denomRegex).Draw(t, "denom"),
|
||||
sdk.NewInt(rapid.Int64Min(1).Draw(t, "amount")),
|
||||
rapid.StringMatching(denomRegex).Draw(rt, "denom"),
|
||||
sdk.NewInt(rapid.Int64Min(1).Draw(rt, "amount")),
|
||||
)
|
||||
|
||||
// NewCoins sorts the denoms
|
||||
@@ -175,8 +171,8 @@ func TestGRPCQuerySpendableBalances(t *testing.T) {
|
||||
err := banktestutil.FundAccount(f.bankKeeper, f.ctx, addr, coins)
|
||||
assert.NilError(t, err)
|
||||
|
||||
req := banktypes.NewQuerySpendableBalancesRequest(addr, testdata.PaginationGenerator(t, uint64(numCoins)).Draw(t, "pagination"))
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.SpendableBalances, 0, true)
|
||||
req := banktypes.NewQuerySpendableBalancesRequest(addr, testdata.PaginationGenerator(rt, uint64(numCoins)).Draw(rt, "pagination"))
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.SpendableBalances, 0, true)
|
||||
})
|
||||
|
||||
coins := sdk.NewCoins(
|
||||
@@ -188,14 +184,13 @@ func TestGRPCQuerySpendableBalances(t *testing.T) {
|
||||
assert.NilError(t, err)
|
||||
|
||||
req := banktypes.NewQuerySpendableBalancesRequest(addr1, nil)
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.SpendableBalances, 2032, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.SpendableBalances, 2032, false)
|
||||
}
|
||||
|
||||
func TestGRPCQueryTotalSupply(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
res, err := f.queryClient.TotalSupply(f.ctx, &banktypes.QueryTotalSupplyRequest{})
|
||||
assert.NilError(t, err)
|
||||
initialSupply := res.GetSupply()
|
||||
@@ -221,7 +216,7 @@ func TestGRPCQueryTotalSupply(t *testing.T) {
|
||||
Pagination: testdata.PaginationGenerator(rt, uint64(len(initialSupply))).Draw(rt, "pagination"),
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.TotalSupply, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.TotalSupply, 0, true)
|
||||
})
|
||||
|
||||
f = initDeterministicFixture(t) // reset
|
||||
@@ -234,14 +229,13 @@ func TestGRPCQueryTotalSupply(t *testing.T) {
|
||||
assert.NilError(t, f.bankKeeper.MintCoins(f.ctx, minttypes.ModuleName, coins))
|
||||
|
||||
req := &banktypes.QueryTotalSupplyRequest{}
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.TotalSupply, 243, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.TotalSupply, 243, false)
|
||||
}
|
||||
|
||||
func TestGRPCQueryTotalSupplyOf(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
coin := sdk.NewCoin(
|
||||
rapid.StringMatching(denomRegex).Draw(rt, "denom"),
|
||||
@@ -251,21 +245,20 @@ func TestGRPCQueryTotalSupplyOf(t *testing.T) {
|
||||
assert.NilError(t, f.bankKeeper.MintCoins(f.ctx, minttypes.ModuleName, sdk.NewCoins(coin)))
|
||||
|
||||
req := &banktypes.QuerySupplyOfRequest{Denom: coin.GetDenom()}
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.SupplyOf, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.SupplyOf, 0, true)
|
||||
})
|
||||
|
||||
coin := sdk.NewCoin("bar", sdk.NewInt(100))
|
||||
|
||||
assert.NilError(t, f.bankKeeper.MintCoins(f.ctx, minttypes.ModuleName, sdk.NewCoins(coin)))
|
||||
req := &banktypes.QuerySupplyOfRequest{Denom: coin.GetDenom()}
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.SupplyOf, 1021, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.SupplyOf, 1021, false)
|
||||
}
|
||||
|
||||
func TestGRPCQueryParams(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
enabledStatus := banktypes.SendEnabled{
|
||||
Denom: rapid.StringMatching(denomRegex).Draw(rt, "denom"),
|
||||
@@ -280,7 +273,7 @@ func TestGRPCQueryParams(t *testing.T) {
|
||||
f.bankKeeper.SetParams(f.ctx, params)
|
||||
|
||||
req := &banktypes.QueryParamsRequest{}
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.Params, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.Params, 0, true)
|
||||
})
|
||||
|
||||
enabledStatus := banktypes.SendEnabled{
|
||||
@@ -296,7 +289,7 @@ func TestGRPCQueryParams(t *testing.T) {
|
||||
f.bankKeeper.SetParams(f.ctx, params)
|
||||
|
||||
req := &banktypes.QueryParamsRequest{}
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.Params, 1003, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.Params, 1003, false)
|
||||
}
|
||||
|
||||
func createAndReturnMetadatas(t *rapid.T, count int) []banktypes.Metadata {
|
||||
@@ -338,7 +331,6 @@ func TestGRPCDenomsMetadata(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
count := rapid.IntRange(1, 3).Draw(rt, "count")
|
||||
denomsMetadata := createAndReturnMetadatas(rt, count)
|
||||
@@ -352,7 +344,7 @@ func TestGRPCDenomsMetadata(t *testing.T) {
|
||||
Pagination: testdata.PaginationGenerator(rt, uint64(count)).Draw(rt, "pagination"),
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.DenomsMetadata, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DenomsMetadata, 0, true)
|
||||
})
|
||||
|
||||
f = initDeterministicFixture(t) // reset
|
||||
@@ -360,14 +352,13 @@ func TestGRPCDenomsMetadata(t *testing.T) {
|
||||
f.bankKeeper.SetDenomMetaData(f.ctx, metadataAtom)
|
||||
|
||||
req := &banktypes.QueryDenomsMetadataRequest{}
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.DenomsMetadata, 660, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DenomsMetadata, 660, false)
|
||||
}
|
||||
|
||||
func TestGRPCDenomMetadata(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
denomMetadata := createAndReturnMetadatas(rt, 1)
|
||||
assert.Assert(t, len(denomMetadata) == 1)
|
||||
@@ -377,7 +368,7 @@ func TestGRPCDenomMetadata(t *testing.T) {
|
||||
Denom: denomMetadata[0].Base,
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.DenomMetadata, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DenomMetadata, 0, true)
|
||||
})
|
||||
|
||||
f.bankKeeper.SetDenomMetaData(f.ctx, metadataAtom)
|
||||
@@ -386,14 +377,13 @@ func TestGRPCDenomMetadata(t *testing.T) {
|
||||
Denom: metadataAtom.Base,
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.DenomMetadata, 1300, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DenomMetadata, 1300, false)
|
||||
}
|
||||
|
||||
func TestGRPCSendEnabled(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
allDenoms := []string{}
|
||||
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
@@ -417,7 +407,7 @@ func TestGRPCSendEnabled(t *testing.T) {
|
||||
// Pagination is only taken into account when `denoms` is an empty array
|
||||
Pagination: testdata.PaginationGenerator(rt, uint64(len(allDenoms))).Draw(rt, "pagination"),
|
||||
}
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.SendEnabled, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.SendEnabled, 0, true)
|
||||
})
|
||||
|
||||
coin1 := banktypes.SendEnabled{
|
||||
@@ -436,14 +426,13 @@ func TestGRPCSendEnabled(t *testing.T) {
|
||||
Denoms: []string{coin1.GetDenom(), coin2.GetDenom()},
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.SendEnabled, 4063, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.SendEnabled, 4063, false)
|
||||
}
|
||||
|
||||
func TestGRPCDenomOwners(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
denom := rapid.StringMatching(denomRegex).Draw(rt, "denom")
|
||||
numAddr := rapid.IntRange(1, 10).Draw(rt, "number-address")
|
||||
@@ -463,7 +452,7 @@ func TestGRPCDenomOwners(t *testing.T) {
|
||||
Denom: denom,
|
||||
Pagination: testdata.PaginationGenerator(rt, uint64(numAddr)).Draw(rt, "pagination"),
|
||||
}
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.DenomOwners, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DenomOwners, 0, true)
|
||||
})
|
||||
|
||||
denomOwners := []*banktypes.DenomOwner{
|
||||
@@ -488,5 +477,5 @@ func TestGRPCDenomOwners(t *testing.T) {
|
||||
req := &banktypes.QueryDenomOwnersRequest{
|
||||
Denom: coin1.GetDenom(),
|
||||
}
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.DenomOwners, 2525, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DenomOwners, 2525, false)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"time"
|
||||
|
||||
"cosmossdk.io/math"
|
||||
"github.com/stretchr/testify/require"
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
"gotest.tools/v3/assert"
|
||||
"pgregory.net/rapid"
|
||||
@@ -243,14 +242,13 @@ func TestGRPCValidator(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
val := createAndSetValidator(rt, f, t)
|
||||
req := &stakingtypes.QueryValidatorRequest{
|
||||
ValidatorAddr: val.OperatorAddress,
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.Validator, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.Validator, 0, true)
|
||||
})
|
||||
|
||||
f = initDeterministicFixture(t) // reset
|
||||
@@ -259,14 +257,13 @@ func TestGRPCValidator(t *testing.T) {
|
||||
ValidatorAddr: val.OperatorAddress,
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.Validator, 1915, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.Validator, 1915, false)
|
||||
}
|
||||
|
||||
func TestGRPCValidators(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
validatorStatus := []string{stakingtypes.BondStatusBonded, stakingtypes.BondStatusUnbonded, stakingtypes.BondStatusUnbonding}
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
valsCount := rapid.IntRange(1, 3).Draw(rt, "num-validators")
|
||||
@@ -279,21 +276,20 @@ func TestGRPCValidators(t *testing.T) {
|
||||
Pagination: testdata.PaginationGenerator(rt, uint64(valsCount)).Draw(rt, "pagination"),
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.Validators, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.Validators, 0, true)
|
||||
})
|
||||
|
||||
f = initDeterministicFixture(t) // reset
|
||||
getStaticValidator(f, t)
|
||||
getStaticValidator2(f, t)
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, require.New(t), &stakingtypes.QueryValidatorsRequest{}, f.queryClient.Validators, 3525, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, &stakingtypes.QueryValidatorsRequest{}, f.queryClient.Validators, 3525, false)
|
||||
}
|
||||
|
||||
func TestGRPCValidatorDelegations(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
validator := createAndSetValidatorWithStatus(rt, f, t, stakingtypes.Bonded)
|
||||
numDels := rapid.IntRange(1, 5).Draw(rt, "num-dels")
|
||||
@@ -309,7 +305,7 @@ func TestGRPCValidatorDelegations(t *testing.T) {
|
||||
Pagination: testdata.PaginationGenerator(rt, uint64(numDels)).Draw(rt, "pagination"),
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.ValidatorDelegations, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.ValidatorDelegations, 0, true)
|
||||
})
|
||||
|
||||
f = initDeterministicFixture(t) // reset
|
||||
@@ -326,14 +322,13 @@ func TestGRPCValidatorDelegations(t *testing.T) {
|
||||
ValidatorAddr: validator.OperatorAddress,
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, require.New(t), req, f.queryClient.ValidatorDelegations, 11985, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.ValidatorDelegations, 11985, false)
|
||||
}
|
||||
|
||||
func TestGRPCValidatorUnbondingDelegations(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
validator := createAndSetValidatorWithStatus(rt, f, t, stakingtypes.Bonded)
|
||||
numDels := rapid.IntRange(1, 3).Draw(rt, "num-dels")
|
||||
@@ -352,7 +347,7 @@ func TestGRPCValidatorUnbondingDelegations(t *testing.T) {
|
||||
Pagination: testdata.PaginationGenerator(rt, uint64(numDels)).Draw(rt, "pagination"),
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.ValidatorUnbondingDelegations, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.ValidatorUnbondingDelegations, 0, true)
|
||||
})
|
||||
|
||||
f = initDeterministicFixture(t) // reset
|
||||
@@ -374,14 +369,13 @@ func TestGRPCValidatorUnbondingDelegations(t *testing.T) {
|
||||
ValidatorAddr: validator.OperatorAddress,
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.ValidatorUnbondingDelegations, 3719, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.ValidatorUnbondingDelegations, 3719, false)
|
||||
}
|
||||
|
||||
func TestGRPCDelegation(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
validator := createAndSetValidatorWithStatus(rt, f, t, stakingtypes.Bonded)
|
||||
delegator := testdata.AddressGenerator(rt).Draw(rt, "delegator")
|
||||
@@ -393,7 +387,7 @@ func TestGRPCDelegation(t *testing.T) {
|
||||
DelegatorAddr: delegator.String(),
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.Delegation, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.Delegation, 0, true)
|
||||
})
|
||||
|
||||
f = initDeterministicFixture(t) // reset
|
||||
@@ -407,14 +401,13 @@ func TestGRPCDelegation(t *testing.T) {
|
||||
DelegatorAddr: delegator1,
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.Delegation, 4635, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.Delegation, 4635, false)
|
||||
}
|
||||
|
||||
func TestGRPCUnbondingDelegation(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
validator := createAndSetValidatorWithStatus(rt, f, t, stakingtypes.Bonded)
|
||||
delegator := testdata.AddressGenerator(rt).Draw(rt, "delegator")
|
||||
@@ -429,7 +422,7 @@ func TestGRPCUnbondingDelegation(t *testing.T) {
|
||||
DelegatorAddr: delegator.String(),
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.UnbondingDelegation, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.UnbondingDelegation, 0, true)
|
||||
})
|
||||
|
||||
f = initDeterministicFixture(t) // reset
|
||||
@@ -446,14 +439,13 @@ func TestGRPCUnbondingDelegation(t *testing.T) {
|
||||
DelegatorAddr: delegator1,
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.UnbondingDelegation, 1621, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.UnbondingDelegation, 1621, false)
|
||||
}
|
||||
|
||||
func TestGRPCDelegatorDelegations(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
numVals := rapid.IntRange(1, 3).Draw(rt, "num-dels")
|
||||
delegator := testdata.AddressGenerator(rt).Draw(rt, "delegator")
|
||||
@@ -469,7 +461,7 @@ func TestGRPCDelegatorDelegations(t *testing.T) {
|
||||
Pagination: testdata.PaginationGenerator(rt, uint64(numVals)).Draw(rt, "pagination"),
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.DelegatorDelegations, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DelegatorDelegations, 0, true)
|
||||
})
|
||||
|
||||
f = initDeterministicFixture(t) // reset
|
||||
@@ -482,14 +474,13 @@ func TestGRPCDelegatorDelegations(t *testing.T) {
|
||||
DelegatorAddr: delegator1,
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.DelegatorDelegations, 4238, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DelegatorDelegations, 4238, false)
|
||||
}
|
||||
|
||||
func TestGRPCDelegatorValidator(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
validator := createAndSetValidatorWithStatus(rt, f, t, stakingtypes.Bonded)
|
||||
|
||||
@@ -502,7 +493,7 @@ func TestGRPCDelegatorValidator(t *testing.T) {
|
||||
ValidatorAddr: validator.OperatorAddress,
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.DelegatorValidator, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DelegatorValidator, 0, true)
|
||||
})
|
||||
|
||||
f = initDeterministicFixture(t) // reset
|
||||
@@ -517,14 +508,13 @@ func TestGRPCDelegatorValidator(t *testing.T) {
|
||||
ValidatorAddr: validator.OperatorAddress,
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.DelegatorValidator, 3563, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DelegatorValidator, 3563, false)
|
||||
}
|
||||
|
||||
func TestGRPCDelegatorUnbondingDelegations(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
numVals := rapid.IntRange(1, 5).Draw(rt, "num-vals")
|
||||
delegator := testdata.AddressGenerator(rt).Draw(rt, "delegator")
|
||||
@@ -543,7 +533,7 @@ func TestGRPCDelegatorUnbondingDelegations(t *testing.T) {
|
||||
Pagination: testdata.PaginationGenerator(rt, uint64(numVals)).Draw(rt, "pagination"),
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.DelegatorUnbondingDelegations, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DelegatorUnbondingDelegations, 0, true)
|
||||
})
|
||||
|
||||
f = initDeterministicFixture(t) // reset
|
||||
@@ -559,14 +549,13 @@ func TestGRPCDelegatorUnbondingDelegations(t *testing.T) {
|
||||
DelegatorAddr: delegator1,
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.DelegatorUnbondingDelegations, 1302, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DelegatorUnbondingDelegations, 1302, false)
|
||||
}
|
||||
|
||||
func TestGRPCHistoricalInfo(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
numVals := rapid.IntRange(1, 5).Draw(rt, "num-vals")
|
||||
vals := make(stakingtypes.Validators, 0, numVals)
|
||||
@@ -592,7 +581,7 @@ func TestGRPCHistoricalInfo(t *testing.T) {
|
||||
Height: height,
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.HistoricalInfo, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.HistoricalInfo, 0, true)
|
||||
})
|
||||
|
||||
f = initDeterministicFixture(t) // reset
|
||||
@@ -616,14 +605,13 @@ func TestGRPCHistoricalInfo(t *testing.T) {
|
||||
Height: height,
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.HistoricalInfo, 1930, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.HistoricalInfo, 1930, false)
|
||||
}
|
||||
|
||||
func TestGRPCDelegatorValidators(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
numVals := rapid.IntRange(1, 3).Draw(rt, "num-dels")
|
||||
delegator := testdata.AddressGenerator(rt).Draw(rt, "delegator")
|
||||
@@ -639,7 +627,7 @@ func TestGRPCDelegatorValidators(t *testing.T) {
|
||||
Pagination: testdata.PaginationGenerator(rt, uint64(numVals)).Draw(rt, "pagination"),
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.DelegatorValidators, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DelegatorValidators, 0, true)
|
||||
})
|
||||
|
||||
f = initDeterministicFixture(t) // reset
|
||||
@@ -650,7 +638,7 @@ func TestGRPCDelegatorValidators(t *testing.T) {
|
||||
assert.NilError(t, err)
|
||||
|
||||
req := &stakingtypes.QueryDelegatorValidatorsRequest{DelegatorAddr: delegator1}
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.DelegatorValidators, 3166, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DelegatorValidators, 3166, false)
|
||||
}
|
||||
|
||||
func TestGRPCPool(t *testing.T) {
|
||||
@@ -660,19 +648,18 @@ func TestGRPCPool(t *testing.T) {
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
createAndSetValidator(rt, f, t)
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, require.New(t), &stakingtypes.QueryPoolRequest{}, f.queryClient.Pool, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, &stakingtypes.QueryPoolRequest{}, f.queryClient.Pool, 0, true)
|
||||
})
|
||||
|
||||
f = initDeterministicFixture(t) // reset
|
||||
getStaticValidator(f, t)
|
||||
testdata.DeterministicIterations(f.ctx, require.New(t), &stakingtypes.QueryPoolRequest{}, f.queryClient.Pool, 6185, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, &stakingtypes.QueryPoolRequest{}, f.queryClient.Pool, 6185, false)
|
||||
}
|
||||
|
||||
func TestGRPCRedelegations(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
validator := createAndSetValidatorWithStatus(rt, f, t, stakingtypes.Bonded)
|
||||
srcValAddr, err := sdk.ValAddressFromBech32(validator.OperatorAddress)
|
||||
@@ -712,7 +699,7 @@ func TestGRPCRedelegations(t *testing.T) {
|
||||
}
|
||||
|
||||
req.Pagination = testdata.PaginationGenerator(rt, uint64(numDels)).Draw(rt, "pagination")
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.Redelegations, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.Redelegations, 0, true)
|
||||
})
|
||||
|
||||
f = initDeterministicFixture(t) // reset
|
||||
@@ -731,14 +718,13 @@ func TestGRPCRedelegations(t *testing.T) {
|
||||
DstValidatorAddr: validator2,
|
||||
}
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, req, f.queryClient.Redelegations, 3920, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.Redelegations, 3920, false)
|
||||
}
|
||||
|
||||
func TestGRPCParams(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := initDeterministicFixture(t)
|
||||
|
||||
tt := require.New(t)
|
||||
rapid.Check(t, func(rt *rapid.T) {
|
||||
params := stakingtypes.Params{
|
||||
BondDenom: rapid.StringMatching(sdk.DefaultCoinDenomRegex()).Draw(rt, "bond-denom"),
|
||||
@@ -752,7 +738,7 @@ func TestGRPCParams(t *testing.T) {
|
||||
err := f.stakingKeeper.SetParams(f.ctx, params)
|
||||
assert.NilError(t, err)
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, &stakingtypes.QueryParamsRequest{}, f.queryClient.Params, 0, true)
|
||||
testdata.DeterministicIterations(f.ctx, t, &stakingtypes.QueryParamsRequest{}, f.queryClient.Params, 0, true)
|
||||
})
|
||||
|
||||
params := stakingtypes.Params{
|
||||
@@ -767,5 +753,5 @@ func TestGRPCParams(t *testing.T) {
|
||||
err := f.stakingKeeper.SetParams(f.ctx, params)
|
||||
assert.NilError(t, err)
|
||||
|
||||
testdata.DeterministicIterations(f.ctx, tt, &stakingtypes.QueryParamsRequest{}, f.queryClient.Params, 1114, false)
|
||||
testdata.DeterministicIterations(f.ctx, t, &stakingtypes.QueryParamsRequest{}, f.queryClient.Params, 1114, false)
|
||||
}
|
||||
|
||||
Vendored
+7
-8
@@ -3,10 +3,11 @@ package testdata
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
"github.com/stretchr/testify/require"
|
||||
grpc "google.golang.org/grpc"
|
||||
"gotest.tools/v3/assert"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@@ -65,11 +66,9 @@ func (m *TestAnyResponse) UnpackInterfaces(unpacker types.AnyUnpacker) error {
|
||||
// 2. That the gas consumption of the query is the same. When
|
||||
// `gasOverwrite` is set to true, we also check that this consumed
|
||||
// gas value is equal to the hardcoded `gasConsumed`.
|
||||
//
|
||||
// TODO: replace "github.com/stretchr/testify/require" with "gotest.tools/v3"
|
||||
func DeterministicIterations[request proto.Message, response proto.Message](
|
||||
ctx sdk.Context,
|
||||
require *require.Assertions,
|
||||
t *testing.T,
|
||||
req request,
|
||||
grpcFn func(context.Context, request, ...grpc.CallOption) (response, error),
|
||||
gasConsumed uint64,
|
||||
@@ -77,7 +76,7 @@ func DeterministicIterations[request proto.Message, response proto.Message](
|
||||
) {
|
||||
before := ctx.GasMeter().GasConsumed()
|
||||
prevRes, err := grpcFn(ctx, req)
|
||||
require.NoError(err)
|
||||
assert.NilError(t, err)
|
||||
if gasOverwrite { // to handle regressions, i.e. check that gas consumption didn't change
|
||||
gasConsumed = ctx.GasMeter().GasConsumed() - before
|
||||
}
|
||||
@@ -85,8 +84,8 @@ func DeterministicIterations[request proto.Message, response proto.Message](
|
||||
for i := 0; i < iterCount; i++ {
|
||||
before := ctx.GasMeter().GasConsumed()
|
||||
res, err := grpcFn(ctx, req)
|
||||
require.Equal(ctx.GasMeter().GasConsumed()-before, gasConsumed)
|
||||
require.NoError(err)
|
||||
require.Equal(res, prevRes)
|
||||
assert.Equal(t, ctx.GasMeter().GasConsumed()-before, gasConsumed)
|
||||
assert.NilError(t, err)
|
||||
assert.DeepEqual(t, res, prevRes)
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+4
-3
@@ -2,8 +2,9 @@ package testdata
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"gotest.tools/v3/assert"
|
||||
"pgregory.net/rapid"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
@@ -44,9 +45,9 @@ func KeyTestPubAddr() (cryptotypes.PrivKey, cryptotypes.PubKey, sdk.AccAddress)
|
||||
}
|
||||
|
||||
// KeyTestPubAddr generates a new secp256r1 keypair.
|
||||
func KeyTestPubAddrSecp256R1(require *require.Assertions) (cryptotypes.PrivKey, cryptotypes.PubKey, sdk.AccAddress) {
|
||||
func KeyTestPubAddrSecp256R1(t *testing.T) (cryptotypes.PrivKey, cryptotypes.PubKey, sdk.AccAddress) {
|
||||
key, err := secp256r1.GenPrivKey()
|
||||
require.NoError(err)
|
||||
assert.NilError(t, err)
|
||||
pub := key.PubKey()
|
||||
addr := sdk.AccAddress(pub.Address())
|
||||
return key, pub, addr
|
||||
|
||||
@@ -4,6 +4,8 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
|
||||
@@ -19,7 +21,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/ante"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestSetPubKey(t *testing.T) {
|
||||
@@ -29,7 +30,7 @@ func TestSetPubKey(t *testing.T) {
|
||||
// keys and addresses
|
||||
priv1, pub1, addr1 := testdata.KeyTestPubAddr()
|
||||
priv2, pub2, addr2 := testdata.KeyTestPubAddr()
|
||||
priv3, pub3, addr3 := testdata.KeyTestPubAddrSecp256R1(require.New(t))
|
||||
priv3, pub3, addr3 := testdata.KeyTestPubAddrSecp256R1(t)
|
||||
|
||||
addrs := []sdk.AccAddress{addr1, addr2, addr3}
|
||||
pubs := []cryptotypes.PubKey{pub1, pub2, pub3}
|
||||
|
||||
@@ -102,7 +102,7 @@ func (suite *DeterministicTestSuite) TestGRPCQueryAccount() {
|
||||
accs := suite.createAndSetAccounts(t, 1)
|
||||
|
||||
req := &types.QueryAccountRequest{Address: accs[0].GetAddress().String()}
|
||||
testdata.DeterministicIterations(suite.ctx, suite.Require(), req, suite.queryClient.Account, 0, true)
|
||||
testdata.DeterministicIterations(suite.ctx, suite.T(), req, suite.queryClient.Account, 0, true)
|
||||
})
|
||||
|
||||
// Regression tests
|
||||
@@ -114,7 +114,7 @@ func (suite *DeterministicTestSuite) TestGRPCQueryAccount() {
|
||||
|
||||
req := &types.QueryAccountRequest{Address: acc1.GetAddress().String()}
|
||||
|
||||
testdata.DeterministicIterations(suite.ctx, suite.Require(), req, suite.queryClient.Account, 1543, false)
|
||||
testdata.DeterministicIterations(suite.ctx, suite.T(), req, suite.queryClient.Account, 1543, false)
|
||||
}
|
||||
|
||||
// pubkeyGenerator creates and returns a random pubkey generator using rapid.
|
||||
@@ -131,7 +131,7 @@ func (suite *DeterministicTestSuite) TestGRPCQueryAccounts() {
|
||||
accs := suite.createAndSetAccounts(t, numAccs)
|
||||
|
||||
req := &types.QueryAccountsRequest{Pagination: testdata.PaginationGenerator(t, uint64(numAccs)).Draw(t, "accounts")}
|
||||
testdata.DeterministicIterations(suite.ctx, suite.Require(), req, suite.queryClient.Accounts, 0, true)
|
||||
testdata.DeterministicIterations(suite.ctx, suite.T(), req, suite.queryClient.Accounts, 0, true)
|
||||
|
||||
for i := 0; i < numAccs; i++ {
|
||||
suite.accountKeeper.RemoveAccount(suite.ctx, accs[i])
|
||||
@@ -156,7 +156,7 @@ func (suite *DeterministicTestSuite) TestGRPCQueryAccounts() {
|
||||
suite.accountKeeper.SetAccount(suite.ctx, acc2)
|
||||
|
||||
req := &types.QueryAccountsRequest{}
|
||||
testdata.DeterministicIterations(suite.ctx, suite.Require(), req, suite.queryClient.Accounts, 1716, false)
|
||||
testdata.DeterministicIterations(suite.ctx, suite.T(), req, suite.queryClient.Accounts, 1716, false)
|
||||
}
|
||||
|
||||
func (suite *DeterministicTestSuite) TestGRPCQueryAccountAddressByID() {
|
||||
@@ -171,7 +171,7 @@ func (suite *DeterministicTestSuite) TestGRPCQueryAccountAddressByID() {
|
||||
suite.accountKeeper.SetAccount(suite.ctx, acc1)
|
||||
|
||||
req := &types.QueryAccountAddressByIDRequest{AccountId: accNum}
|
||||
testdata.DeterministicIterations(suite.ctx, suite.Require(), req, suite.queryClient.AccountAddressByID, 0, true)
|
||||
testdata.DeterministicIterations(suite.ctx, suite.T(), req, suite.queryClient.AccountAddressByID, 0, true)
|
||||
})
|
||||
|
||||
// Regression test
|
||||
@@ -182,7 +182,7 @@ func (suite *DeterministicTestSuite) TestGRPCQueryAccountAddressByID() {
|
||||
|
||||
suite.accountKeeper.SetAccount(suite.ctx, acc1)
|
||||
req := &types.QueryAccountAddressByIDRequest{AccountId: accNum}
|
||||
testdata.DeterministicIterations(suite.ctx, suite.Require(), req, suite.queryClient.AccountAddressByID, 1123, false)
|
||||
testdata.DeterministicIterations(suite.ctx, suite.T(), req, suite.queryClient.AccountAddressByID, 1123, false)
|
||||
}
|
||||
|
||||
func (suite *DeterministicTestSuite) TestGRPCQueryParameters() {
|
||||
@@ -198,7 +198,7 @@ func (suite *DeterministicTestSuite) TestGRPCQueryParameters() {
|
||||
suite.Require().NoError(err)
|
||||
|
||||
req := &types.QueryParamsRequest{}
|
||||
testdata.DeterministicIterations(suite.ctx, suite.Require(), req, suite.queryClient.Params, 0, true)
|
||||
testdata.DeterministicIterations(suite.ctx, suite.T(), req, suite.queryClient.Params, 0, true)
|
||||
})
|
||||
|
||||
// Regression test
|
||||
@@ -208,7 +208,7 @@ func (suite *DeterministicTestSuite) TestGRPCQueryParameters() {
|
||||
suite.Require().NoError(err)
|
||||
|
||||
req := &types.QueryParamsRequest{}
|
||||
testdata.DeterministicIterations(suite.ctx, suite.Require(), req, suite.queryClient.Params, 1042, false)
|
||||
testdata.DeterministicIterations(suite.ctx, suite.T(), req, suite.queryClient.Params, 1042, false)
|
||||
}
|
||||
|
||||
func (suite *DeterministicTestSuite) TestGRPCQueryAccountInfo() {
|
||||
@@ -217,7 +217,7 @@ func (suite *DeterministicTestSuite) TestGRPCQueryAccountInfo() {
|
||||
suite.Require().Len(accs, 1)
|
||||
|
||||
req := &types.QueryAccountInfoRequest{Address: accs[0].GetAddress().String()}
|
||||
testdata.DeterministicIterations(suite.ctx, suite.Require(), req, suite.queryClient.AccountInfo, 0, true)
|
||||
testdata.DeterministicIterations(suite.ctx, suite.T(), req, suite.queryClient.AccountInfo, 0, true)
|
||||
})
|
||||
|
||||
// Regression test
|
||||
@@ -228,7 +228,7 @@ func (suite *DeterministicTestSuite) TestGRPCQueryAccountInfo() {
|
||||
|
||||
suite.accountKeeper.SetAccount(suite.ctx, acc)
|
||||
req := &types.QueryAccountInfoRequest{Address: acc.GetAddress().String()}
|
||||
testdata.DeterministicIterations(suite.ctx, suite.Require(), req, suite.queryClient.AccountInfo, 1543, false)
|
||||
testdata.DeterministicIterations(suite.ctx, suite.T(), req, suite.queryClient.AccountInfo, 1543, false)
|
||||
}
|
||||
|
||||
func (suite *DeterministicTestSuite) createAndReturnQueryClient(ak keeper.AccountKeeper) types.QueryClient {
|
||||
@@ -290,7 +290,7 @@ func (suite *DeterministicTestSuite) TestGRPCQueryModuleAccounts() {
|
||||
|
||||
queryClient := suite.createAndReturnQueryClient(ak)
|
||||
req := &types.QueryModuleAccountsRequest{}
|
||||
testdata.DeterministicIterations(suite.ctx, suite.Require(), req, queryClient.ModuleAccounts, 0, true)
|
||||
testdata.DeterministicIterations(suite.ctx, suite.T(), req, queryClient.ModuleAccounts, 0, true)
|
||||
})
|
||||
|
||||
maccs := make([]string, 0, len(suite.maccPerms))
|
||||
@@ -302,7 +302,7 @@ func (suite *DeterministicTestSuite) TestGRPCQueryModuleAccounts() {
|
||||
|
||||
queryClient := suite.createAndReturnQueryClient(suite.accountKeeper)
|
||||
req := &types.QueryModuleAccountsRequest{}
|
||||
testdata.DeterministicIterations(suite.ctx, suite.Require(), req, queryClient.ModuleAccounts, 8565, false)
|
||||
testdata.DeterministicIterations(suite.ctx, suite.T(), req, queryClient.ModuleAccounts, 8565, false)
|
||||
}
|
||||
|
||||
func (suite *DeterministicTestSuite) TestGRPCQueryModuleAccountByName() {
|
||||
@@ -336,7 +336,7 @@ func (suite *DeterministicTestSuite) TestGRPCQueryModuleAccountByName() {
|
||||
|
||||
queryClient := suite.createAndReturnQueryClient(ak)
|
||||
req := &types.QueryModuleAccountByNameRequest{Name: mName}
|
||||
testdata.DeterministicIterations(suite.ctx, suite.Require(), req, queryClient.ModuleAccountByName, 0, true)
|
||||
testdata.DeterministicIterations(suite.ctx, suite.T(), req, queryClient.ModuleAccountByName, 0, true)
|
||||
})
|
||||
|
||||
maccs := make([]string, 0, len(suite.maccPerms))
|
||||
@@ -348,5 +348,5 @@ func (suite *DeterministicTestSuite) TestGRPCQueryModuleAccountByName() {
|
||||
|
||||
queryClient := suite.createAndReturnQueryClient(suite.accountKeeper)
|
||||
req := &types.QueryModuleAccountByNameRequest{Name: "mint"}
|
||||
testdata.DeterministicIterations(suite.ctx, suite.Require(), req, queryClient.ModuleAccountByName, 1372, false)
|
||||
testdata.DeterministicIterations(suite.ctx, suite.T(), req, queryClient.ModuleAccountByName, 1372, false)
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ require (
|
||||
github.com/golang/glog v1.0.0 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/btree v1.1.2 // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/google/orderedcode v0.0.1 // indirect
|
||||
github.com/gorilla/handlers v1.5.1 // indirect
|
||||
github.com/gorilla/mux v1.8.0 // indirect
|
||||
@@ -140,6 +141,7 @@ require (
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gotest.tools/v3 v3.4.0 // indirect
|
||||
nhooyr.io/websocket v1.8.6 // indirect
|
||||
pgregory.net/rapid v0.5.5 // indirect
|
||||
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||
|
||||
@@ -369,6 +369,7 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
@@ -1281,6 +1282,7 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o=
|
||||
gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g=
|
||||
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
||||
Reference in New Issue
Block a user