fix: increase timers for nameservice tests

This commit is contained in:
nabarun 2022-04-21 00:45:52 +05:30
parent 2ea883bc50
commit 9d4c381e1a
4 changed files with 19 additions and 15 deletions

View File

@ -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()))
}
})
}

View File

@ -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

View File

@ -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

View File

@ -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 {