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

fix: Improve mocks generation #604

Merged
merged 1 commit into from
May 9, 2023
Merged

Conversation

Kynea0b
Copy link
Contributor

@Kynea0b Kynea0b 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.

@Kynea0b Kynea0b requested review from torao, tnasu 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.

@Kynea0b Kynea0b 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.
@Kynea0b Kynea0b 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
@Kynea0b Kynea0b merged commit 0d8a0fd into Finschia:main May 9, 2023
@Kynea0b Kynea0b 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