From 9d4c381e1a2d419da8fa7ccead5cc5cd6468162b Mon Sep 17 00:00:00 2001 From: nabarun Date: Thu, 21 Apr 2022 00:45:52 +0530 Subject: [PATCH] fix: increase timers for nameservice tests --- x/nameservice/client/testutil/grpc.go | 15 ++++++++------- x/nameservice/client/testutil/query.go | 6 +++--- x/nameservice/client/testutil/tx.go | 4 ++-- x/nameservice/keeper/grpc_query_test.go | 9 ++++++--- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/x/nameservice/client/testutil/grpc.go b/x/nameservice/client/testutil/grpc.go index e4c51016..fd7a16e3 100644 --- a/x/nameservice/client/testutil/grpc.go +++ b/x/nameservice/client/testutil/grpc.go @@ -52,8 +52,8 @@ func (s *IntegrationTestSuite) TestGRPCQueryParams() { sr.NoError(err) params := nstypes.DefaultParams() params.RecordRent = sdk.NewCoin(s.cfg.BondDenom, nstypes.DefaultRecordRent) - params.RecordRentDuration = 5 * time.Second - params.AuthorityGracePeriod = 5 * time.Second + params.RecordRentDuration = 10 * time.Second + params.AuthorityGracePeriod = 10 * time.Second sr.Equal(response.GetParams().String(), params.String()) } }) @@ -237,8 +237,8 @@ func (s *IntegrationTestSuite) TestGRPCQueryRecordExpiryQueue() { if !tc.expectErr { tc.preRun(s.bondId) } - // wait 7 seconds for records expires - time.Sleep(time.Second * 7) + // wait 12 seconds for records expires + time.Sleep(time.Second * 12) resp, _ := rest.GetRequest(tc.url) require := s.Require() if tc.expectErr { @@ -307,8 +307,8 @@ func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() { if !tc.expectErr { tc.preRun("QueryAuthorityExpiryQueue") } - // wait 7 seconds to name authorites expires - time.Sleep(time.Second * 7) + // wait 12 seconds to name authorites expires + time.Sleep(time.Second * 12) resp, _ := rest.GetRequest(tc.url) require := s.Require() @@ -318,7 +318,8 @@ func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() { var response nstypes.QueryGetAuthorityExpiryQueueResponse err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) sr.NoError(err) - sr.NotZero(len(response.GetAuthorities())) + // removed from expiry queue as no bond set + sr.Zero(len(response.GetAuthorities())) } }) } diff --git a/x/nameservice/client/testutil/query.go b/x/nameservice/client/testutil/query.go index c2824b85..0616fb0b 100644 --- a/x/nameservice/client/testutil/query.go +++ b/x/nameservice/client/testutil/query.go @@ -40,8 +40,8 @@ func (s *IntegrationTestSuite) TestGetCmdQueryParams() { sr.NoError(err) params := types.DefaultParams() params.RecordRent = sdk.NewCoin(s.cfg.BondDenom, types.DefaultRecordRent) - params.RecordRentDuration = 5 * time.Second - params.AuthorityGracePeriod = 5 * time.Second + params.RecordRentDuration = 10 * time.Second + params.AuthorityGracePeriod = 10 * time.Second sr.Equal(param.GetParams().String(), params.String()) }) } @@ -433,7 +433,7 @@ func (s *IntegrationTestSuite) GetRecordExpiryQueue() { s.Run(tc.name, func() { if !tc.expErr { tc.preRun(authorityName, s) - time.Sleep(time.Second * 7) + time.Sleep(time.Second * 12) } cmd := cli.GetRecordExpiryQueue() clientCtx := val.ClientCtx diff --git a/x/nameservice/client/testutil/tx.go b/x/nameservice/client/testutil/tx.go index afc9aaab..d45ecd9b 100644 --- a/x/nameservice/client/testutil/tx.go +++ b/x/nameservice/client/testutil/tx.go @@ -47,8 +47,8 @@ func (s *IntegrationTestSuite) SetupSuite() { s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[nstypes.ModuleName], &nsData)) nsData.Params.RecordRent = sdk.NewCoin(s.cfg.BondDenom, nstypes.DefaultRecordRent) - nsData.Params.RecordRentDuration = 5 * time.Second - nsData.Params.AuthorityGracePeriod = 5 * time.Second + nsData.Params.RecordRentDuration = 10 * time.Second + nsData.Params.AuthorityGracePeriod = 10 * time.Second nsDataBz, err := s.cfg.Codec.MarshalJSON(&nsData) s.Require().NoError(err) genesisState[nstypes.ModuleName] = nsDataBz diff --git a/x/nameservice/keeper/grpc_query_test.go b/x/nameservice/keeper/grpc_query_test.go index 713a659f..331a2676 100644 --- a/x/nameservice/keeper/grpc_query_test.go +++ b/x/nameservice/keeper/grpc_query_test.go @@ -3,9 +3,10 @@ package keeper_test import ( "context" "fmt" + "os" + "github.com/tharsis/ethermint/x/nameservice/client/cli" nameservicetypes "github.com/tharsis/ethermint/x/nameservice/types" - "os" ) func (suite *KeeperTestSuite) TestGrpcQueryParams() { @@ -62,12 +63,13 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { sr.NoError(err) payload, err := cli.GetPayloadFromFile(dir + "/../helpers/examples/example1.yml") sr.NoError(err) - err = suite.app.NameServiceKeeper.ProcessSetRecord(ctx, nameservicetypes.MsgSetRecord{ + record, err := suite.app.NameServiceKeeper.ProcessSetRecord(ctx, nameservicetypes.MsgSetRecord{ BondId: suite.bond.GetId(), Signer: suite.accounts[0].String(), Payload: payload.ToPayload(), }) sr.NoError(err) + sr.NotNil(record.Id) } resp, err := grpcClient.ListRecords(context.Background(), test.req) if test.expErr { @@ -192,12 +194,13 @@ func (suite *KeeperTestSuite) TestGrpcQueryNameserviceModuleBalance() { sr.NoError(err) payload, err := cli.GetPayloadFromFile(dir + "/../helpers/examples/example1.yml") sr.NoError(err) - err = suite.app.NameServiceKeeper.ProcessSetRecord(ctx, nameservicetypes.MsgSetRecord{ + record, err := suite.app.NameServiceKeeper.ProcessSetRecord(ctx, nameservicetypes.MsgSetRecord{ BondId: suite.bond.GetId(), Signer: suite.accounts[0].String(), Payload: payload.ToPayload(), }) sr.NoError(err) + sr.NotNil(record.Id) } resp, err := grpcClient.GetNameServiceModuleBalance(context.Background(), test.req) if test.expErr {