Skip to content

fix: Improve mocks generation#604

Merged
kokehiM0chi merged 1 commit intoFinschia:mainfrom
kokehiM0chi:modify-Mockery
May 9, 2023
Merged

fix: Improve mocks generation#604
kokehiM0chi merged 1 commit intoFinschia:mainfrom
kokehiM0chi:modify-Mockery

Conversation

@kokehiM0chi
Copy link
Contributor

@kokehiM0chi kokehiM0chi commented May 9, 2023

Description

Mockery was supposed to be installed in the local environment, but that assumption is not necessarily guaranteed. It is something that a repository should guarantee.

In this PR, a fix was made to manage the mockery package with go.mod and execute it directly with script.

The path is specified as a relative path according to Tendermint as follows.
The reason is to avoid conflicts during backporting.

Ex.

//go:generate ../scripts/mockery_generate.sh [interface name]

This PR exists in tendermint/tendermint, but since Go 1.17 we can go run external packages directly, so we don't need to use docker.

Main:
tendermint/tendermint#9094

Two Mockery improvement PR exist in the 34.x version, but cherry-pick is not desirable because it includes more than just Mock changes.

tendermint/tendermint#8863
tendermint/tendermint#9114

This PR is for making Mockery work correctly.

@kokehiM0chi kokehiM0chi requested review from tnasu, torao and ulbqb as code owners May 9, 2023 07:02
@CLAassistant
Copy link

CLAassistant commented May 9, 2023

CLA assistant check
All committers have signed the CLA.

@kokehiM0chi kokehiM0chi marked this pull request as draft May 9, 2023 07:35
@codecov
Copy link

codecov bot commented May 9, 2023

Codecov Report

Merging #604 (5496309) into main (c80f1b7) will decrease coverage by 0.06%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #604      +/-   ##
==========================================
- Coverage   66.31%   66.25%   -0.06%     
==========================================
  Files         277      277              
  Lines       36969    36969              
==========================================
- Hits        24515    24494      -21     
- Misses      10688    10713      +25     
+ Partials     1766     1762       -4     
Impacted Files Coverage Δ
abci/client/client.go 80.85% <ø> (ø)
abci/client/grpc_client.go 69.37% <ø> (ø)
abci/client/local_client.go 99.20% <ø> (ø)
abci/client/socket_client.go 72.96% <ø> (ø)
abci/example/kvstore/helpers.go 100.00% <ø> (ø)
abci/example/kvstore/kvstore.go 73.83% <ø> (ø)
abci/example/kvstore/persistent_kvstore.go 50.00% <ø> (ø)
abci/types/application.go 0.00% <ø> (ø)
abci/types/pubkey.go 0.00% <ø> (ø)
behaviour/peer_behaviour.go 75.00% <ø> (ø)
... and 118 more

... and 3 files with indirect coverage changes

Since go 1.17 we can call external packages directly.
@kokehiM0chi kokehiM0chi marked this pull request as ready for review May 9, 2023 08:25
@tnasu tnasu added the C: enhancement Classification: New feature or its request, or improvement in maintainability of code label May 9, 2023
@kokehiM0chi kokehiM0chi merged commit 0d8a0fd into Finschia:main May 9, 2023
@kokehiM0chi kokehiM0chi deleted the modify-Mockery branch May 10, 2023 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C: enhancement Classification: New feature or its request, or improvement in maintainability of code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants