Skip to content

Commit

Permalink
fix tests to use UTC time
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Sep 9, 2024
1 parent 7bd4923 commit 051d6e6
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion benchmark/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func GenSequenceOfTxs(b *testing.B, info *AppInfo, msgGen func(*AppInfo, int) ([
msgs, err := msgGen(info, i)
require.NoError(b, err)
txs[i], err = simtestutil.GenSignedMockTx(
rand.New(rand.NewSource(time.Now().UnixNano())),
rand.New(rand.NewSource(time.Now().UTC().UnixNano())),
info.TxConfig,
msgs,
fees,
Expand Down
2 changes: 1 addition & 1 deletion x/authz/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Where authzItems.json contains:
cmd.Flags().StringSlice(FlagAllowedValidators, []string{}, "Allowed validators addresses separated by ,")
cmd.Flags().StringSlice(FlagDenyValidators, []string{}, "Deny validators addresses separated by ,")
cmd.Flags().StringSlice(FlagAllowList, []string{}, "Allowed addresses grantee is allowed to send funds separated by ,")
cmd.Flags().Int64(FlagExpiration, time.Now().AddDate(1, 0, 0).Unix(), "The Unix timestamp. Default is one year.")
cmd.Flags().Int64(FlagExpiration, time.Now().UTC().AddDate(1, 0, 0).Unix(), "The Unix timestamp. Default is one year.")
cmd.Flags().String(FlagType, "", "The type of move authorization, {publish|excute}")
cmd.Flags().String(FlagItems, "", "The items of move execute authorization, a json file path.")
cmd.Flags().String(FlagModules, "", "The items of move publish authorization, a comma-separated string of module names.")
Expand Down
2 changes: 1 addition & 1 deletion x/genutil/gentx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func TestValidateAccountInGenesis(t *testing.T) {

// msg := banktypes.NewMsgSend(addr1, addr2, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 1)})
// tx, err := helpers.GenSignedMockTx(
// rand.New(rand.NewSource(time.Now().UnixNano())),
// rand.New(rand.NewSource(time.Now().UTC().UnixNano())),
// suite.encodingConfig.TxConfig,
// []sdk.Msg{msg},
// sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 10)},
Expand Down
2 changes: 1 addition & 1 deletion x/gov/keeper/tally_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func Test_Tally(t *testing.T) {
require.NoError(t, err)

// 15 minutes passed
ctx = ctx.WithBlockTime(time.Now().Add(time.Minute * 15))
ctx = ctx.WithBlockTime(time.Now().UTC().Add(time.Minute * 15))

quorumReached, passed, burnDeposits, tallyResults, err := input.GovKeeper.Tally(ctx, params, proposal)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion x/ibc/nft-transfer/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ corresponding to the counterpartychannel. Any timeout set to 0 is disabled.`),
// use local clock time as reference time if it is later than the
// consensus state timestamp of the counter party chain, otherwise
// still use consensus state timestamp as reference
now := time.Now().UnixNano()
now := time.Now().UTC().UnixNano()
consensusStateTimestamp := consensusState.GetTimestamp()
if now > 0 {
now := uint64(now)
Expand Down

0 comments on commit 051d6e6

Please sign in to comment.