Browse Source

add and run make target for generating existing mocks (#6732)

There are many `//go:generate mockery` lines in the source code.
This change adds a make target to invoke these mock generations.
This change also invokes the mock invocations and adds the resulting mocks to the repo.

Related to #5274
pull/6736/head
William Banfield 3 years ago
committed by GitHub
parent
commit
f70396c6fd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 20 additions and 47 deletions
  1. +13
    -0
      Makefile
  2. +1
    -1
      abci/client/mocks/client.go
  3. +1
    -1
      internal/p2p/mocks/connection.go
  4. +1
    -1
      internal/p2p/mocks/peer.go
  5. +1
    -1
      internal/p2p/mocks/transport.go
  6. +2
    -0
      light/provider/provider.go
  7. +1
    -1
      rpc/client/mocks/client.go
  8. +0
    -42
      state/mocks/store.go

+ 13
- 0
Makefile View File

@ -231,6 +231,19 @@ build-docker: build-linux
rm -rf DOCKER/tendermint rm -rf DOCKER/tendermint
.PHONY: build-docker .PHONY: build-docker
###############################################################################
### Testing ###
###############################################################################
mockery:
go generate -run="mockery" ./...
.PHONY: mockery
test:
go test ./...
.PHONY: test
############################################################################### ###############################################################################
### Local testnet using docker ### ### Local testnet using docker ###
############################################################################### ###############################################################################


+ 1
- 1
abci/client/mocks/client.go View File

@ -1,4 +1,4 @@
// Code generated by mockery 2.7.4. DO NOT EDIT.
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
package mocks package mocks


+ 1
- 1
internal/p2p/mocks/connection.go View File

@ -1,4 +1,4 @@
// Code generated by mockery 2.7.4. DO NOT EDIT.
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
package mocks package mocks


+ 1
- 1
internal/p2p/mocks/peer.go View File

@ -1,4 +1,4 @@
// Code generated by mockery 2.7.4. DO NOT EDIT.
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
package mocks package mocks


+ 1
- 1
internal/p2p/mocks/transport.go View File

@ -1,4 +1,4 @@
// Code generated by mockery 2.7.4. DO NOT EDIT.
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
package mocks package mocks


+ 2
- 0
light/provider/provider.go View File

@ -6,6 +6,8 @@ import (
"github.com/tendermint/tendermint/types" "github.com/tendermint/tendermint/types"
) )
//go:generate mockery --case underscore --name Provider
// Provider provides information for the light client to sync (verification // Provider provides information for the light client to sync (verification
// happens in the client). // happens in the client).
type Provider interface { type Provider interface {


+ 1
- 1
rpc/client/mocks/client.go View File

@ -1,4 +1,4 @@
// Code generated by mockery 2.7.4. DO NOT EDIT.
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
package mocks package mocks


+ 0
- 42
state/mocks/store.go View File

@ -95,48 +95,6 @@ func (_m *Store) LoadConsensusParams(_a0 int64) (types.ConsensusParams, error) {
return r0, r1 return r0, r1
} }
// LoadFromDBOrGenesisDoc provides a mock function with given fields: _a0
func (_m *Store) LoadFromDBOrGenesisDoc(_a0 *types.GenesisDoc) (state.State, error) {
ret := _m.Called(_a0)
var r0 state.State
if rf, ok := ret.Get(0).(func(*types.GenesisDoc) state.State); ok {
r0 = rf(_a0)
} else {
r0 = ret.Get(0).(state.State)
}
var r1 error
if rf, ok := ret.Get(1).(func(*types.GenesisDoc) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// LoadFromDBOrGenesisFile provides a mock function with given fields: _a0
func (_m *Store) LoadFromDBOrGenesisFile(_a0 string) (state.State, error) {
ret := _m.Called(_a0)
var r0 state.State
if rf, ok := ret.Get(0).(func(string) state.State); ok {
r0 = rf(_a0)
} else {
r0 = ret.Get(0).(state.State)
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// LoadValidators provides a mock function with given fields: _a0 // LoadValidators provides a mock function with given fields: _a0
func (_m *Store) LoadValidators(_a0 int64) (*types.ValidatorSet, error) { func (_m *Store) LoadValidators(_a0 int64) (*types.ValidatorSet, error) {
ret := _m.Called(_a0) ret := _m.Called(_a0)


Loading…
Cancel
Save