Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use mocks for x/slashing #12937

Merged
merged 10 commits into from
Aug 17, 2022
1 change: 1 addition & 0 deletions scripts/mockgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ $mockgen_cmd -source=x/auth/ante/expected_keepers.go -package testutil -destinat
$mockgen_cmd -source=x/authz/expected_keepers.go -package testutil -destination x/authz/testutil/expected_keepers_mocks.go
$mockgen_cmd -source=x/bank/types/expected_keepers.go -package testutil -destination x/bank/testutil/expected_keepers_mocks.go
$mockgen_cmd -source=x/evidence/types/expected_keepers.go -package testutil -destination x/evidence/testutil/expected_keepers_mocks.go
$mockgen_cmd -source=x/slashing/types/expected_keepers.go -package testutil -destination x/slashing/testutil/expected_keepers_mocks.go
5 changes: 2 additions & 3 deletions tests/e2e/slashing/client/testutil/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ import (

"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/testutil/network"
clienttestutil "github.com/cosmos/cosmos-sdk/x/slashing/client/testutil"

"github.com/stretchr/testify/suite"
)

func TestIntegrationTestSuite(t *testing.T) {
func TestEndToEndTestSuite(t *testing.T) {
cfg := network.DefaultConfig(simapp.NewTestNetworkFixture)
cfg.NumValidators = 1
suite.Run(t, clienttestutil.NewIntegrationTestSuite(cfg))
suite.Run(t, NewEndToEndTestSuite(cfg))
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/slashing/types"
)

func (s *IntegrationTestSuite) TestGRPCQueries() {
func (s *EndToEndTestSuite) TestGRPCQueries() {
val := s.network.Validators[0]
baseURL := val.APIAddress

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ import (
"github.com/cosmos/cosmos-sdk/x/slashing/client/cli"
)

type IntegrationTestSuite struct {
type EndToEndTestSuite struct {
suite.Suite

cfg network.Config
network *network.Network
}

func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite {
return &IntegrationTestSuite{cfg: cfg}
func NewEndToEndTestSuite(cfg network.Config) *EndToEndTestSuite {
return &EndToEndTestSuite{cfg: cfg}
}

// SetupSuite executes bootstrapping logic before all the tests, i.e. once before
// the entire suite, start executing.
func (s *IntegrationTestSuite) SetupSuite() {
func (s *EndToEndTestSuite) SetupSuite() {
s.T().Log("setting up integration test suite")

var err error
Expand All @@ -41,12 +41,12 @@ func (s *IntegrationTestSuite) SetupSuite() {

// TearDownSuite performs cleanup logic after all the tests, i.e. once after the
// entire suite, has finished executing.
func (s *IntegrationTestSuite) TearDownSuite() {
func (s *EndToEndTestSuite) TearDownSuite() {
s.T().Log("tearing down integration test suite")
s.network.Cleanup()
}

func (s *IntegrationTestSuite) TestGetCmdQuerySigningInfo() {
func (s *EndToEndTestSuite) TestGetCmdQuerySigningInfo() {
val := s.network.Validators[0]
pubKeyBz, err := s.cfg.Codec.MarshalInterfaceJSON(val.PubKey)
s.Require().NoError(err)
Expand Down Expand Up @@ -104,7 +104,7 @@ tombstoned: false`, sdk.ConsAddress(val.PubKey.Address())),
}
}

func (s *IntegrationTestSuite) TestGetCmdQueryParams() {
func (s *EndToEndTestSuite) TestGetCmdQueryParams() {
val := s.network.Validators[0]

testCases := []struct {
Expand Down Expand Up @@ -142,7 +142,7 @@ slash_fraction_downtime: "0.010000000000000000"`,
}
}

func (s *IntegrationTestSuite) TestNewUnjailTxCmd() {
func (s *EndToEndTestSuite) TestNewUnjailTxCmd() {
val := s.network.Validators[0]
testCases := []struct {
name string
Expand Down
Loading