From f794ba1bf9e3ce56164b14d4edf8fcb36518ccf7 Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Sat, 7 Dec 2019 15:08:07 +0000 Subject: [PATCH] use time consistently in tests --- x/cdp/integration_test.go | 6 +++--- x/cdp/keeper/integration_test.go | 6 +++--- x/cdp/keeper/keeper_test.go | 2 +- x/liquidator/keeper/integration_test.go | 2 +- x/liquidator/keeper/keeper_test.go | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/x/cdp/integration_test.go b/x/cdp/integration_test.go index f3a301da..abf674fb 100644 --- a/x/cdp/integration_test.go +++ b/x/cdp/integration_test.go @@ -5,9 +5,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" "github.com/kava-labs/kava/x/pricefeed" - "github.com/kava-labs/kava/app" ) // Avoid cluttering test cases with long function name @@ -30,7 +30,7 @@ func NewPFGenState(asset string, price sdk.Dec) app.GenesisState { MarketID: asset, OracleAddress: sdk.AccAddress{}, Price: price, - Expiry: time.Unix(9999999999, 0), // some deterministic future date, + Expiry: time.Now().Add(1 * time.Hour), }, }, } @@ -53,4 +53,4 @@ func NewCDPGenState(asset string, liquidationRatio sdk.Dec) app.GenesisState { CDPs: cdp.CDPs{}, } return app.GenesisState{cdp.ModuleName: cdp.ModuleCdc.MustMarshalJSON(cdpGenesis)} -} \ No newline at end of file +} diff --git a/x/cdp/keeper/integration_test.go b/x/cdp/keeper/integration_test.go index af8ad4c6..23fd6722 100644 --- a/x/cdp/keeper/integration_test.go +++ b/x/cdp/keeper/integration_test.go @@ -29,7 +29,7 @@ func NewPricefeedGenState(asset string, price sdk.Dec) app.GenesisState { MarketID: asset, OracleAddress: sdk.AccAddress{}, Price: price, - Expiry: time.Unix(9999999999, 0), // some deterministic future date, + Expiry: time.Now().Add(1 * time.Hour), }, }, } @@ -67,13 +67,13 @@ func NewPricefeedGenStateMulti() app.GenesisState { MarketID: "btc", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("8000.00"), - Expiry: time.Unix(9999999999, 0), // some deterministic future date, + Expiry: time.Now().Add(1 * time.Hour), }, pricefeed.PostedPrice{ MarketID: "xrp", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("0.25"), - Expiry: time.Unix(9999999999, 0), // some deterministic future date, + Expiry: time.Now().Add(1 * time.Hour), }, }, } diff --git a/x/cdp/keeper/keeper_test.go b/x/cdp/keeper/keeper_test.go index 33983c85..35f2b696 100644 --- a/x/cdp/keeper/keeper_test.go +++ b/x/cdp/keeper/keeper_test.go @@ -164,7 +164,7 @@ func TestKeeper_PartialSeizeCDP(t *testing.T) { // Reduce price tApp.GetPriceFeedKeeper().SetPrice( ctx, sdk.AccAddress{}, collateral, - d("0.90"), time.Unix(9999999999, 0)) // some deterministic future date + d("0.90"), time.Now().Add(1*time.Hour)) tApp.GetPriceFeedKeeper().SetCurrentPrices(ctx, collateral) // Seize entire CDP diff --git a/x/liquidator/keeper/integration_test.go b/x/liquidator/keeper/integration_test.go index 32f57bbf..53f936ac 100644 --- a/x/liquidator/keeper/integration_test.go +++ b/x/liquidator/keeper/integration_test.go @@ -31,7 +31,7 @@ func NewPricefeedGenState(asset string, price sdk.Dec) app.GenesisState { MarketID: asset, OracleAddress: sdk.AccAddress{}, Price: price, - Expiry: time.Unix(9999999999, 0), // some deterministic future date, + Expiry: time.Now().Add(1 * time.Hour), }, }, } diff --git a/x/liquidator/keeper/keeper_test.go b/x/liquidator/keeper/keeper_test.go index c6598f06..4541f3da 100644 --- a/x/liquidator/keeper/keeper_test.go +++ b/x/liquidator/keeper/keeper_test.go @@ -28,7 +28,7 @@ func TestKeeper_SeizeAndStartCollateralAuction(t *testing.T) { require.NoError(t, tApp.GetCDPKeeper().ModifyCDP(ctx, addrs[0], "btc", i(3), i(16000))) - _, err := tApp.GetPriceFeedKeeper().SetPrice(ctx, addrs[0], "btc", d("7999.99"), time.Unix(9999999999, 0)) + _, err := tApp.GetPriceFeedKeeper().SetPrice(ctx, addrs[0], "btc", d("7999.99"), time.Now().Add(1*time.Hour)) require.NoError(t, err) require.NoError(t, tApp.GetPriceFeedKeeper().SetCurrentPrices(ctx, "btc"))