From 069be95dde7dc5dac62db3464cc4faf3d9383c15 Mon Sep 17 00:00:00 2001 From: Robert Pirtle Date: Thu, 29 Feb 2024 12:09:07 -0800 Subject: [PATCH] fix: update vesting tests to use fixed block time (#1838) * fix: update SWP circulating supply test constant * use fixed blocktime for vesting tests --- x/validator-vesting/keeper/grpc_query_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x/validator-vesting/keeper/grpc_query_test.go b/x/validator-vesting/keeper/grpc_query_test.go index b4a848aa..b6c22c0e 100644 --- a/x/validator-vesting/keeper/grpc_query_test.go +++ b/x/validator-vesting/keeper/grpc_query_test.go @@ -7,7 +7,6 @@ import ( sdkmath "cosmossdk.io/math" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmtime "github.com/cometbft/cometbft/types/time" "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" @@ -38,12 +37,13 @@ func (m *mockBankKeeper) GetSupply(ctx sdk.Context, denom string) sdk.Coin { } func (suite *grpcQueryTestSuite) SetupTest() { + testTime := time.Date(2024, 2, 29, 12, 00, 00, 00, time.UTC) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: testTime}) suite.app = tApp suite.ctx = ctx suite.bk = &mockBankKeeper{} - suite.queryClient = suite.queryClientWithBlockTime(tmtime.Now()) + suite.queryClient = suite.queryClientWithBlockTime(testTime) } func TestGrpcQueryTestSuite(t *testing.T) { @@ -89,9 +89,9 @@ func (suite *grpcQueryTestSuite) TestCirculatingSupplyUSDX() { } func (suite *grpcQueryTestSuite) TestCirculatingSupplySWP() { - res, err := suite.queryClient.CirculatingSupplySWP(context.Background(), &types.QueryCirculatingSupplySWPRequest{}) + res, err := suite.queryClient.CirculatingSupplySWP(suite.ctx, &types.QueryCirculatingSupplySWPRequest{}) suite.Require().NoError(err) - suite.Require().Equal(sdkmath.NewInt(198437490), res.Amount) + suite.Require().Equal(sdkmath.NewInt(201302073), res.Amount) } func (suite *grpcQueryTestSuite) TestTotalSupplyHARD() {