Skip to content

Commit

Permalink
chore: fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aleem1314 committed Aug 2, 2022
1 parent be2e491 commit fdcb556
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 43 deletions.
2 changes: 1 addition & 1 deletion scripts/test_cover.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ for m in ${SUBMODULES[@]}; do
cd $CURDIR/$m
PKGS=$(go list ./...)
for pkg in ${PKGS[@]}; do
go test -v -timeout 30m -coverpkg=all -coverprofile=profile.out -covermode=atomic -tags="norace ledger test_ledger_mock rocksdb_build $EXPERIMENTAL_TAG" "$pkg"
go test -v -timeout 30m -coverpkg=all -coverprofile=profile.out -covermode=atomic -tags="norace ledger test_ledger_mock $EXPERIMENTAL_TAG" "$pkg"
if [ -f profile.out ]; then
tail -n +2 profile.out >> $CURDIR/coverage.txt;
rm profile.out
Expand Down
11 changes: 11 additions & 0 deletions x/ecocredit/basket/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ package basket

import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
)

func RegisterTypes(registry codectypes.InterfaceRegistry) {
Expand All @@ -21,5 +25,12 @@ var (
)

func init() {
RegisterLegacyAminoCodec(legacy.Cdc)
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)
sdk.RegisterLegacyAminoCodec(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
13 changes: 0 additions & 13 deletions x/ecocredit/basket/msg_put_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import (
"github.com/gogo/protobuf/jsonpb"
"github.com/regen-network/gocuke"
"github.com/stretchr/testify/require"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/regen-network/regen-ledger/types"
)

type msgPutSuite struct {
Expand All @@ -22,15 +18,6 @@ func TestMsgPut(t *testing.T) {
gocuke.NewRunner(t, &msgPutSuite{}).Path("./features/msg_put.feature").Run()
}

func (s *msgPutSuite) Before(t gocuke.TestingT) {
s.t = t

// TODO: remove after updating to cosmos-sdk v0.46 #857
sdk.SetCoinDenomRegex(func() string {
return types.CoinDenomRegex
})
}

func (s *msgPutSuite) TheMessage(a gocuke.DocString) {
s.msg = &MsgPut{}
err := jsonpb.UnmarshalString(a.Content, s.msg)
Expand Down
13 changes: 0 additions & 13 deletions x/ecocredit/basket/msg_take_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import (
"github.com/gogo/protobuf/jsonpb"
"github.com/regen-network/gocuke"
"github.com/stretchr/testify/require"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/regen-network/regen-ledger/types"
)

type msgTakeSuite struct {
Expand All @@ -22,15 +18,6 @@ func TestMsgTake(t *testing.T) {
gocuke.NewRunner(t, &msgTakeSuite{}).Path("./features/msg_take.feature").Run()
}

func (s *msgTakeSuite) Before(t gocuke.TestingT) {
s.t = t

// TODO: remove after updating to cosmos-sdk v0.46 #857
sdk.SetCoinDenomRegex(func() string {
return types.CoinDenomRegex
})
}

func (s *msgTakeSuite) TheMessage(a gocuke.DocString) {
s.msg = &MsgTake{}
err := jsonpb.UnmarshalString(a.Content, s.msg)
Expand Down
11 changes: 11 additions & 0 deletions x/ecocredit/core/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ package core

import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)

Expand Down Expand Up @@ -35,5 +39,12 @@ var (
)

func init() {
RegisterLegacyAminoCodec(legacy.Cdc)
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)
sdk.RegisterLegacyAminoCodec(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
11 changes: 11 additions & 0 deletions x/ecocredit/marketplace/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ package marketplace

import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)

Expand All @@ -24,5 +28,12 @@ var (
)

func init() {
RegisterLegacyAminoCodec(legacy.Cdc)
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)
sdk.RegisterLegacyAminoCodec(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
5 changes: 0 additions & 5 deletions x/ecocredit/server/basket/msg_put_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ func (s *putSuite) Before(t gocuke.TestingT) {
s.batchDenom = "C01-001-20200101-20210101-001"
s.basketDenom = "eco.uC.NCT"
s.tradableCredits = "100"

// TODO: remove after updating to cosmos-sdk v0.46 #857
sdk.SetCoinDenomRegex(func() string {
return types.CoinDenomRegex
})
}

func (s *putSuite) ACreditType() {
Expand Down
6 changes: 0 additions & 6 deletions x/ecocredit/server/basket/msg_take_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/gogo/protobuf/jsonpb"
"github.com/regen-network/gocuke"
"github.com/regen-network/regen-ledger/types"
"github.com/stretchr/testify/require"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -55,11 +54,6 @@ func (s *takeSuite) Before(t gocuke.TestingT) {
s.basketDenom = "eco.uC.NCT"
s.tokenAmount = "100"
s.jurisdiction = "US-WA"

// TODO: remove after updating to cosmos-sdk v0.46 #857
sdk.SetCoinDenomRegex(func() string {
return types.CoinDenomRegex
})
}

func (s *takeSuite) ACreditType() {
Expand Down
5 changes: 0 additions & 5 deletions x/ecocredit/server/testsuite/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ func NewIntegrationTestSuite(fixtureFactory testutil.FixtureFactory, paramSpace
}

func (s *IntegrationTestSuite) SetupSuite() {
// TODO: remove after updating to cosmos-sdk v0.46 #857
sdk.SetCoinDenomRegex(func() string {
return types.CoinDenomRegex
})

s.fixture = s.fixtureFactory.Setup()

s.codec = s.fixture.Codec()
Expand Down

0 comments on commit fdcb556

Please sign in to comment.