Skip to content

Commit

Permalink
don't add tests (reduce diff) (#215)
Browse files Browse the repository at this point in the history
* don't add tests (reduce diff)

* Update keeper_test.go

* Update grpc_query_test.go

* Update capability_test.go
  • Loading branch information
faddat authored Jul 11, 2023
1 parent a45dcd7 commit ed259fd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package keeper_test

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

"github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
)

Expand Down
28 changes: 8 additions & 20 deletions modules/apps/27-interchain-accounts/host/keeper/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,8 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() {
proposal, err := govv1.NewProposal([]sdk.Msg{proposalMsg}, govtypes.DefaultStartingProposalID, suite.chainA.GetContext().BlockTime(), suite.chainA.GetContext().BlockTime(), "test proposal", "title", "Description", sdk.AccAddress(interchainAccountAddr), false)
suite.Require().NoError(err)

err = suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal)
suite.Require().NoError(err)

err = suite.chainB.GetSimApp().GovKeeper.ActivateVotingPeriod(suite.chainB.GetContext(), proposal)
suite.Require().NoError(err)
suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal)
suite.chainB.GetSimApp().GovKeeper.ActivateVotingPeriod(suite.chainB.GetContext(), proposal)

msg := &govtypes.MsgVote{
ProposalId: govtypes.DefaultStartingProposalID,
Expand Down Expand Up @@ -222,11 +219,8 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() {
proposal, err := govv1.NewProposal([]sdk.Msg{proposalMsg}, govtypes.DefaultStartingProposalID, suite.chainA.GetContext().BlockTime(), suite.chainA.GetContext().BlockTime(), "test proposal", "title", "description", sdk.AccAddress(interchainAccountAddr), false)
suite.Require().NoError(err)

err = suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal)
suite.Require().NoError(err)

err = suite.chainB.GetSimApp().GovKeeper.ActivateVotingPeriod(suite.chainB.GetContext(), proposal)
suite.Require().NoError(err)
suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal)
suite.chainB.GetSimApp().GovKeeper.ActivateVotingPeriod(suite.chainB.GetContext(), proposal)

msg := &govtypes.MsgVote{
ProposalId: govtypes.DefaultStartingProposalID,
Expand Down Expand Up @@ -543,11 +537,8 @@ func (suite *KeeperTestSuite) TestJSONOnRecvPacket() {
proposal, err := govv1.NewProposal([]sdk.Msg{proposalMsg}, govtypes.DefaultStartingProposalID, suite.chainA.GetContext().BlockTime(), suite.chainA.GetContext().BlockTime(), "test proposal", "title", "Description", sdk.AccAddress(interchainAccountAddr), false)
suite.Require().NoError(err)

err = suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal)
suite.Require().NoError(err)

err = suite.chainB.GetSimApp().GovKeeper.ActivateVotingPeriod(suite.chainB.GetContext(), proposal)
suite.Require().NoError(err)
suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal)
suite.chainB.GetSimApp().GovKeeper.ActivateVotingPeriod(suite.chainB.GetContext(), proposal)

msgBytes := []byte(`{
"messages": [
Expand Down Expand Up @@ -642,11 +633,8 @@ func (suite *KeeperTestSuite) TestJSONOnRecvPacket() {
proposal, err := govv1.NewProposal([]sdk.Msg{proposalMsg}, govtypes.DefaultStartingProposalID, suite.chainA.GetContext().BlockTime(), suite.chainA.GetContext().BlockTime(), "test proposal", "title", "description", sdk.AccAddress(interchainAccountAddr), false)
suite.Require().NoError(err)

err = suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal)
suite.Require().NoError(err)

err = suite.chainB.GetSimApp().GovKeeper.ActivateVotingPeriod(suite.chainB.GetContext(), proposal)
suite.Require().NoError(err)
suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal)
suite.chainB.GetSimApp().GovKeeper.ActivateVotingPeriod(suite.chainB.GetContext(), proposal)

msgBytes := []byte(`{
"messages": [
Expand Down
11 changes: 6 additions & 5 deletions modules/capability/capability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (suite *CapabilityTestSuite) SetupTest() {
cdc := app.AppCodec()

// create new keeper so we can define custom scoping before init and seal
keeper := keeper.NewKeeper(cdc, app.GetKey(types.StoreKey), app.GetKey(types.MemStoreKey))
keeper := keeper.NewKeeper(cdc, app.GetKey(types.StoreKey), app.GetMemKey(types.MemStoreKey))

suite.app = app
suite.ctx = app.BaseApp.NewContext(checkTx)
Expand All @@ -62,7 +62,7 @@ func (suite *CapabilityTestSuite) TestInitializeMemStore() {
newKeeper.Seal()
suite.Require().False(newKeeper.IsInitialized(ctx), "memstore initialized flag set before BeginBlock")

// Mock app beginblock and ensure that no gas has been consumed and memstore is initialized
// Mock app BeginBlock and ensure that no gas has been consumed and memstore is initialized
ctx = suite.app.BaseApp.NewContext(false)

prevBlockGas := ctx.BlockGasMeter().GasConsumed()
Expand All @@ -81,8 +81,8 @@ func (suite *CapabilityTestSuite) TestInitializeMemStore() {
// Mock the first transaction getting capability and subsequently failing
// by using a cached context and discarding all cached writes.
cacheCtx, _ := ctx.CacheContext()
capability, ok := newSk1.GetCapability(cacheCtx, "transfer")
suite.Require().NotNil(capability)
transferCapability, ok := newSk1.GetCapability(cacheCtx, "transfer")
suite.Require().NotNil(transferCapability)
suite.Require().True(ok)

// Ensure that the second transaction can still receive capability even if first tx fails.
Expand All @@ -94,7 +94,8 @@ func (suite *CapabilityTestSuite) TestInitializeMemStore() {
// Ensure the capabilities don't get reinitialized on next BeginBlock
// by testing to see if capability returns same pointer
// also check that initialized flag is still set
restartedModule.BeginBlock(ctx)
err = restartedModule.BeginBlock(ctx)
suite.Require().NoError(err)
recap, ok := newSk1.GetCapability(ctx, "transfer")
suite.Require().True(ok)
suite.Require().Equal(cap1, recap, "capabilities got reinitialized after second BeginBlock")
Expand Down
2 changes: 1 addition & 1 deletion modules/capability/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
// ExportGenesis returns the capability module's exported genesis.
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
index := k.GetLatestIndex(ctx)
owners := []types.GenesisOwners{}
var owners []types.GenesisOwners

for i := uint64(1); i < index; i++ {
capabilityOwners, ok := k.GetOwners(ctx, i)
Expand Down

0 comments on commit ed259fd

Please sign in to comment.