Skip to content

Commit

Permalink
fix mockery generation script (#9094)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters authored Jul 26, 2022
1 parent 46badfa commit a11b774
Show file tree
Hide file tree
Showing 27 changed files with 81 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Check generated code
on:
pull_request:
branches:
- v0.34.x
- main

permissions:
contents: read
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ install:
### Mocks ###
###############################################################################

mockery:
mockery:
go generate -run="./scripts/mockery_generate.sh" ./...
.PHONY: mockery
.PHONY: mockery

###############################################################################
### Protobuf ###
Expand Down
6 changes: 3 additions & 3 deletions evidence/mocks/block_store.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion evidence/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/tendermint/tendermint/types"
)

//go:generate mockery --case underscore --name BlockStore
//go:generate ../scripts/mockery_generate.sh BlockStore

type BlockStore interface {
LoadBlockMeta(height int64) *types.BlockMeta
Expand Down
2 changes: 1 addition & 1 deletion light/rpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var errNegOrZeroHeight = errors.New("negative or zero height")
type KeyPathFunc func(path string, key []byte) (merkle.KeyPath, error)

// LightClient is an interface that contains functionality needed by Client from the light client.
//go:generate mockery --case underscore --name LightClient
//go:generate ../../scripts/mockery_generate.sh LightClient
type LightClient interface {
ChainID() string
Update(ctx context.Context, now time.Time) (*types.LightBlock, error)
Expand Down
6 changes: 3 additions & 3 deletions light/rpc/mocks/light_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions p2p/mocks/peer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion p2p/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
tmconn "github.com/tendermint/tendermint/p2p/conn"
)

//go:generate mockery --case underscore --name Peer
//go:generate ../scripts/mockery_generate.sh Peer

const metricsTickerDuration = 10 * time.Second

Expand Down
2 changes: 1 addition & 1 deletion proxy/app_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/tendermint/tendermint/abci/types"
)

//go:generate mockery --case underscore --name AppConnConsensus|AppConnMempool|AppConnQuery|AppConnSnapshot
//go:generate ../scripts/mockery_generate.sh AppConnConsensus|AppConnMempool|AppConnQuery|AppConnSnapshot

//----------------------------------------------------------------------------------------
// Enforce which abci msgs can be sent on a connection at the type level
Expand Down
2 changes: 2 additions & 0 deletions proxy/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
e2e "github.com/tendermint/tendermint/test/e2e/app"
)

//go:generate ../scripts/mockery_generate.sh ClientCreator

// ClientCreator creates new ABCI clients.
type ClientCreator interface {
// NewABCIClient returns a new ABCI client.
Expand Down
6 changes: 3 additions & 3 deletions proxy/mocks/app_conn_consensus.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions proxy/mocks/app_conn_mempool.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions proxy/mocks/app_conn_query.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions proxy/mocks/app_conn_snapshot.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions proxy/mocks/client_creator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions scripts/mockery_generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
#
# Invoke Mockery v2 to update generated mocks for the given type.
#
# This script runs a locally-installed "mockery" if available, otherwise it
# runs the published Docker container. This legerdemain is so that the CI build
# and a local build can work off the same script.
#
if ! which mockery ; then
mockery() {
docker run --rm -v "$PWD":/w --workdir=/w vektra/mockery:v2.12.3
}
fi

mockery --disable-version-string --case underscore --name "$@"
2 changes: 1 addition & 1 deletion state/indexer/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/tendermint/tendermint/types"
)

//go:generate mockery --case underscore --name BlockIndexer
//go:generate ../../scripts/mockery_generate.sh BlockIndexer

// BlockIndexer defines an interface contract for indexing block events.
type BlockIndexer interface {
Expand Down
2 changes: 1 addition & 1 deletion state/indexer/mocks/block_indexer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions state/mocks/block_store.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions state/mocks/evidence_pool.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions state/mocks/store.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions state/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
//------------------------------------------------------
// blockstore

//go:generate mockery --case underscore --name BlockStore
//go:generate ../scripts/mockery_generate.sh BlockStore

// BlockStore defines the interface used by the ConsensusState.
type BlockStore interface {
Expand All @@ -38,7 +38,7 @@ type BlockStore interface {
//-----------------------------------------------------------------------------
// evidence pool

//go:generate mockery --case underscore --name EvidencePool
//go:generate ../scripts/mockery_generate.sh EvidencePool

// EvidencePool defines the EvidencePool interface used by State.
type EvidencePool interface {
Expand Down
2 changes: 1 addition & 1 deletion state/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func calcABCIResponsesKey(height int64) []byte {

//----------------------

//go:generate mockery --case underscore --name Store
//go:generate ../scripts/mockery_generate.sh Store

// Store defines the state store interface
//
Expand Down
2 changes: 1 addition & 1 deletion state/txindex/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// XXX/TODO: These types should be moved to the indexer package.

//go:generate mockery --case underscore --name TxIndexer
//go:generate ../../scripts/mockery_generate.sh TxIndexer

// TxIndexer interface defines methods to index and search transactions.
type TxIndexer interface {
Expand Down
2 changes: 1 addition & 1 deletion state/txindex/mocks/tx_indexer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a11b774

Please sign in to comment.