From 6d1e4ed6612a370eb424edf5273a0fed922103a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cessenmeoikia=E2=80=9D?= Date: Wed, 18 Dec 2024 22:01:28 +0700 Subject: [PATCH 1/3] fix test TestValidateGenesisState --- .../genesis/types/genesis_test.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go b/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go index 8413a68f83f..da06cd44b12 100644 --- a/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go +++ b/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go @@ -9,6 +9,7 @@ import ( genesistypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/genesis/types" hosttypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) @@ -34,33 +35,33 @@ func (suite *GenesisTypesTestSuite) TestValidateGenesisState() { testCases := []struct { name string malleate func() - expPass bool + expErr error }{ { "success", func() {}, - true, + nil, }, { "failed to validate - empty value", func() { genesisState = genesistypes.GenesisState{} }, - false, + host.ErrInvalidID, }, { "failed to validate - invalid controller genesis", func() { genesisState = *genesistypes.NewGenesisState(genesistypes.ControllerGenesisState{Ports: []string{"invalid|port"}}, genesistypes.DefaultHostGenesis()) }, - false, + host.ErrInvalidID, }, { "failed to validate - invalid host genesis", func() { genesisState = *genesistypes.NewGenesisState(genesistypes.DefaultControllerGenesis(), genesistypes.HostGenesisState{}) }, - false, + host.ErrInvalidID, }, } @@ -74,10 +75,11 @@ func (suite *GenesisTypesTestSuite) TestValidateGenesisState() { err := genesisState.Validate() - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err, tc.name) } else { suite.Require().Error(err, tc.name) + suite.Require().ErrorIs(err, tc.expErr) } }) } From 56052774b7e213af033d75d2ffa1d51cb88b9e65 Mon Sep 17 00:00:00 2001 From: meoikia Date: Wed, 18 Dec 2024 22:28:39 +0700 Subject: [PATCH 2/3] Update modules/apps/27-interchain-accounts/genesis/types/genesis_test.go Co-authored-by: DimitrisJim --- .../apps/27-interchain-accounts/genesis/types/genesis_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go b/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go index da06cd44b12..65691c5caad 100644 --- a/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go +++ b/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go @@ -8,8 +8,8 @@ import ( controllertypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types" genesistypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/genesis/types" hosttypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" host "github.com/cosmos/ibc-go/v9/modules/core/24-host" + icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) From 82aa979a1bb778ae0a02ca6c128cf21e04d6a61a Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Wed, 18 Dec 2024 19:56:19 +0200 Subject: [PATCH 3/3] chore: bad linter call --- .../apps/27-interchain-accounts/genesis/types/genesis_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go b/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go index 65691c5caad..da06cd44b12 100644 --- a/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go +++ b/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go @@ -8,8 +8,8 @@ import ( controllertypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types" genesistypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/genesis/types" hosttypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibctesting "github.com/cosmos/ibc-go/v9/testing" )