Skip to content

Commit

Permalink
[1760]: Disable address caching for a bunch more tests because I can'…
Browse files Browse the repository at this point in the history
…t find the one stupid one's that are causing the cache to have bad entries.
  • Loading branch information
SpicyLemon committed May 15, 2024
1 parent 4284406 commit fbcf2e0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/provenanced/cmd/docgen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
genutiltest "github.com/cosmos/cosmos-sdk/x/genutil/client/testutil"

"github.com/provenance-io/provenance/app"
Expand All @@ -25,6 +26,10 @@ import (
)

func TestDocGen(t *testing.T) {
origCache := sdk.IsAddrCacheEnabled()
defer sdk.SetAddrCacheEnabled(origCache)
sdk.SetAddrCacheEnabled(false)

appCodec := app.MakeTestEncodingConfig(t).Marshaler
tests := []struct {
name string
Expand Down
20 changes: 20 additions & 0 deletions cmd/provenanced/cmd/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ import (
var testMbm = module.NewBasicManager(genutil.AppModuleBasic{})

func TestAddGenesisMsgFeeCmd(t *testing.T) {
origCache := sdk.IsAddrCacheEnabled()
defer sdk.SetAddrCacheEnabled(origCache)
sdk.SetAddrCacheEnabled(false)

appCodec := app.MakeTestEncodingConfig(t).Marshaler
tests := []struct {
name string
Expand Down Expand Up @@ -205,6 +209,10 @@ func fixEmptiesInExchangeGenState(exGenState *exchange.GenesisState) {
}

func TestAddGenesisDefaultMarketCmd(t *testing.T) {
origCache := sdk.IsAddrCacheEnabled()
defer sdk.SetAddrCacheEnabled(origCache)
sdk.SetAddrCacheEnabled(false)

pioconfig.SetProvenanceConfig("", 0)
cdc := app.MakeTestEncodingConfig(t).Marshaler
expDefaultMarket := func(marketID uint32, denom string, addrs ...string) exchange.Market {
Expand Down Expand Up @@ -392,6 +400,10 @@ func TestAddGenesisDefaultMarketCmd(t *testing.T) {
}

func TestMakeDefaultMarket(t *testing.T) {
origCache := sdk.IsAddrCacheEnabled()
defer sdk.SetAddrCacheEnabled(origCache)
sdk.SetAddrCacheEnabled(false)

addrs := []string{
"one_________________",
"two_________________",
Expand Down Expand Up @@ -699,6 +711,10 @@ func TestAddGenesisCustomMarketCmd(t *testing.T) {
}

func TestAddMarketsToAppState(t *testing.T) {
origCache := sdk.IsAddrCacheEnabled()
defer sdk.SetAddrCacheEnabled(origCache)
sdk.SetAddrCacheEnabled(false)

appCdc := app.MakeTestEncodingConfig(t).Marshaler
askOrder := *exchange.NewOrder(1).WithAsk(&exchange.AskOrder{
MarketId: 1,
Expand Down Expand Up @@ -826,6 +842,10 @@ func TestAddMarketsToAppState(t *testing.T) {
}

func TestGetNextAvailableMarketID(t *testing.T) {
origCache := sdk.IsAddrCacheEnabled()
defer sdk.SetAddrCacheEnabled(origCache)
sdk.SetAddrCacheEnabled(false)

tests := []struct {
name string
exGenState exchange.GenesisState
Expand Down
5 changes: 5 additions & 0 deletions cmd/provenanced/cmd/pre_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server"
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/provenance-io/provenance/app"
cmderrors "github.com/provenance-io/provenance/cmd/errors"
Expand Down Expand Up @@ -211,6 +212,10 @@ func makeDummyCmd(t *testing.T, cdc codec.Codec, home string) *cobra.Command {
}

func TestPreUpgradeCmd(t *testing.T) {
origCache := sdk.IsAddrCacheEnabled()
defer sdk.SetAddrCacheEnabled(origCache)
sdk.SetAddrCacheEnabled(false)

pioconfig.SetProvenanceConfig("", 0)
encodingConfig := app.MakeTestEncodingConfig(t)
cdc := encodingConfig.Marshaler
Expand Down
6 changes: 6 additions & 0 deletions cmd/provenanced/cmd/simulate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@ type SimulateTestSuite struct {
account2Addr sdk.AccAddress

floorGasPrice sdk.Coin

origAddrCacheEnabled bool
}

func (s *SimulateTestSuite) SetupTest() {
s.origAddrCacheEnabled = sdk.IsAddrCacheEnabled()
sdk.SetAddrCacheEnabled(false)

s.accountKey = secp256k1.GenPrivKeyFromSecret([]byte("acc2"))
addr, err := sdk.AccAddressFromHexUnsafe(s.accountKey.PubKey().Address().String())
s.Require().NoError(err)
Expand Down Expand Up @@ -85,6 +90,7 @@ func (s *SimulateTestSuite) SetupTest() {

func (s *SimulateTestSuite) TearDownTest() {
testutil.Cleanup(s.testnet, s.T())
sdk.SetAddrCacheEnabled(s.origAddrCacheEnabled)
}

func TestSimulateTestSuite(t *testing.T) {
Expand Down

0 comments on commit fbcf2e0

Please sign in to comment.