From f7dd3385032541e9263d97a7cc4f4819ce35de44 Mon Sep 17 00:00:00 2001 From: Cosmin Damian <17934949+cdamian@users.noreply.github.com> Date: Wed, 6 Jul 2022 12:42:01 +0300 Subject: [PATCH] make: Add generate-mocks target (#275) --- Makefile | 3 +++ rpc/author/author.go | 2 +- rpc/author/mocks/{Author.go => author.go} | 0 rpc/beefy/beefy.go | 2 +- rpc/beefy/mocks/{Beefy.go => beefy.go} | 0 rpc/chain/chain.go | 2 +- rpc/chain/mocks/{Chain.go => chain.go} | 0 rpc/mmr/mmr.go | 2 +- rpc/mmr/mocks/{MMR.go => mmr.go} | 0 rpc/offchain/mocks/{Offchain.go => offchain.go} | 0 rpc/offchain/offchain.go | 2 +- rpc/state/mocks/{State.go => state.go} | 0 rpc/state/state.go | 2 +- rpc/system/mocks/{System.go => system.go} | 0 rpc/system/system.go | 2 +- 15 files changed, 10 insertions(+), 7 deletions(-) rename rpc/author/mocks/{Author.go => author.go} (100%) rename rpc/beefy/mocks/{Beefy.go => beefy.go} (100%) rename rpc/chain/mocks/{Chain.go => chain.go} (100%) rename rpc/mmr/mocks/{MMR.go => mmr.go} (100%) rename rpc/offchain/mocks/{Offchain.go => offchain.go} (100%) rename rpc/state/mocks/{State.go => state.go} (100%) rename rpc/system/mocks/{System.go => system.go} (100%) diff --git a/Makefile b/Makefile index 159a183ea..a897ae00a 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,9 @@ generate-test-data: ## generate data for types decode test test-types-decode: ## run tests for types decode @go test -tags=types_test ./types/test/... +generate-mocks: ## generate mocks + @docker run -v `pwd`:/app -w /app --entrypoint /bin/sh vektra/mockery:v2.13.0-beta.1 -c 'go generate ./...' + help: ## shows this help @sed -ne '/@sed/!s/## //p' $(MAKEFILE_LIST) diff --git a/rpc/author/author.go b/rpc/author/author.go index d96da7b08..b2a89f146 100644 --- a/rpc/author/author.go +++ b/rpc/author/author.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:generate mockery --name Author +//go:generate mockery --name Author --filename author.go package author diff --git a/rpc/author/mocks/Author.go b/rpc/author/mocks/author.go similarity index 100% rename from rpc/author/mocks/Author.go rename to rpc/author/mocks/author.go diff --git a/rpc/beefy/beefy.go b/rpc/beefy/beefy.go index c3407c85f..63909912d 100644 --- a/rpc/beefy/beefy.go +++ b/rpc/beefy/beefy.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:generate mockery --name Beefy +//go:generate mockery --name Beefy --filename beefy.go package beefy diff --git a/rpc/beefy/mocks/Beefy.go b/rpc/beefy/mocks/beefy.go similarity index 100% rename from rpc/beefy/mocks/Beefy.go rename to rpc/beefy/mocks/beefy.go diff --git a/rpc/chain/chain.go b/rpc/chain/chain.go index 9fe9f19e9..7a773643e 100644 --- a/rpc/chain/chain.go +++ b/rpc/chain/chain.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:generate mockery --name Chain +//go:generate mockery --name Chain --filename chain.go package chain diff --git a/rpc/chain/mocks/Chain.go b/rpc/chain/mocks/chain.go similarity index 100% rename from rpc/chain/mocks/Chain.go rename to rpc/chain/mocks/chain.go diff --git a/rpc/mmr/mmr.go b/rpc/mmr/mmr.go index eda92d67a..7807fb33b 100644 --- a/rpc/mmr/mmr.go +++ b/rpc/mmr/mmr.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:generate mockery --name MMR +//go:generate mockery --name MMR --filename mmr.go package mmr diff --git a/rpc/mmr/mocks/MMR.go b/rpc/mmr/mocks/mmr.go similarity index 100% rename from rpc/mmr/mocks/MMR.go rename to rpc/mmr/mocks/mmr.go diff --git a/rpc/offchain/mocks/Offchain.go b/rpc/offchain/mocks/offchain.go similarity index 100% rename from rpc/offchain/mocks/Offchain.go rename to rpc/offchain/mocks/offchain.go diff --git a/rpc/offchain/offchain.go b/rpc/offchain/offchain.go index ca412d2ee..344884a57 100644 --- a/rpc/offchain/offchain.go +++ b/rpc/offchain/offchain.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:generate mockery --name Offchain +//go:generate mockery --name Offchain --filename offchain.go package offchain diff --git a/rpc/state/mocks/State.go b/rpc/state/mocks/state.go similarity index 100% rename from rpc/state/mocks/State.go rename to rpc/state/mocks/state.go diff --git a/rpc/state/state.go b/rpc/state/state.go index 04d4898f0..54815ae50 100644 --- a/rpc/state/state.go +++ b/rpc/state/state.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:generate mockery --name State +//go:generate mockery --name State --filename state.go package state diff --git a/rpc/system/mocks/System.go b/rpc/system/mocks/system.go similarity index 100% rename from rpc/system/mocks/System.go rename to rpc/system/mocks/system.go diff --git a/rpc/system/system.go b/rpc/system/system.go index 7e24eb508..57fe843d3 100644 --- a/rpc/system/system.go +++ b/rpc/system/system.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:generate mockery --name System +//go:generate mockery --name System --filename system.go package system