Skip to content

Commit 003a6ef

Browse files
author
Jason Yellick
committedMay 23, 2018
FAB-10331 Fix mockery mock generation
The comments in the go files which are supposed to generate the mockery mocks are malformed. They use: // go:generate ... instead of //go:generate They also assume they are being executed from the root directory, rather than the current directory. This CR modifies those statements to correct those errors, regenerates all the mocks, and updates the license check to ignore mockery style mocks. Change-Id: I7d8ca47254459e2929286cf614e09893b254d35d Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
1 parent cee7e9b commit 003a6ef

28 files changed

+21
-349
lines changed
 

‎core/cclifecycle/lifecycle.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ type LifeCycleChangeListener interface {
3939
// HandleMetadataUpdate is triggered upon a change in the chaincode lifecycle change
4040
type HandleMetadataUpdate func(channel string, chaincodes chaincode.MetadataSet)
4141

42-
// go:generate mockery -dir core/cclifecycle -name LifeCycleChangeListener -case underscore -output core/cclifecycle/mocks/
42+
//go:generate mockery -dir . -name LifeCycleChangeListener -case underscore -output mocks/
4343

4444
// LifeCycleChangeListener runs whenever there is a change to the metadata
4545
// // of a chaincode in the context of a specific channel
4646
func (mdUpdate HandleMetadataUpdate) LifeCycleChangeListener(channel string, chaincodes chaincode.MetadataSet) {
4747
mdUpdate(channel, chaincodes)
4848
}
4949

50-
// go:generate mockery -dir core/cclifecycle -name Enumerator -case underscore -output core/cclifecycle/mocks/
50+
//go:generate mockery -dir . -name Enumerator -case underscore -output mocks/
5151

5252
// Enumerator enumerates chaincodes
5353
type Enumerator interface {
@@ -63,7 +63,7 @@ func (listCCs Enumerate) Enumerate() ([]chaincode.InstalledChaincode, error) {
6363
return listCCs()
6464
}
6565

66-
// go:generate mockery -dir core/cclifecycle -name Query -case underscore -output core/cclifecycle/mocks/
66+
//go:generate mockery -dir . -name Query -case underscore -output mocks/
6767

6868
// Query queries the state
6969
type Query interface {
@@ -74,7 +74,7 @@ type Query interface {
7474
Done()
7575
}
7676

77-
// go:generate mockery -dir core/cclifecycle -name QueryCreator -case underscore -output core/cclifecycle/mocks/
77+
//go:generate mockery -dir . -name QueryCreator -case underscore -output mocks/
7878

7979
// QueryCreator creates queries
8080
type QueryCreator interface {

‎core/cclifecycle/mocks/enumerator.go

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎core/cclifecycle/mocks/life_cycle_change_listener.go

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎core/cclifecycle/mocks/query.go

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎core/cclifecycle/mocks/query_creator.go

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎core/committer/txvalidator/mocks/capabilities.go

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎core/committer/txvalidator/mocks/identity_deserializer.go

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎core/committer/txvalidator/mocks/plugin.go

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎core/committer/txvalidator/mocks/plugin_factory.go

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎core/committer/txvalidator/mocks/plugin_mapper.go

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎core/committer/txvalidator/mocks/query_executor_creator.go

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎core/committer/txvalidator/plugin_validator.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ func (m MapBasedPluginMapper) PluginFactoryByName(name PluginName) validation.Pl
3030
return m[string(name)]
3131
}
3232

33-
// go:generate mockery -dir core/committer/txvalidator/ -name PluginMapper -case underscore -output core/committer/txvalidator/mocks
34-
// go:generate mockery -dir core/handlers/validation/api/ -name PluginFactory -case underscore -output core/committer/txvalidator/mocks/
35-
// go:generate mockery -dir core/handlers/validation/api/ -name Plugin -case underscore -output core/committer/txvalidator/mocks/
33+
//go:generate mockery -dir . -name PluginMapper -case underscore -output mocks/
34+
//go:generate mockery -dir ../../handlers/validation/api/ -name PluginFactory -case underscore -output mocks/
35+
//go:generate mockery -dir ../../handlers/validation/api/ -name Plugin -case underscore -output mocks/
3636

3737
// PluginMapper maps plugin names to their corresponding factory instance.
3838
// Returns nil if the name isn't associated to any plugin.
3939
type PluginMapper interface {
4040
PluginFactoryByName(name PluginName) validation.PluginFactory
4141
}
4242

43-
// go:generate mockery -dir core/committer/txvalidator/ -name QueryExecutorCreator -case underscore -output core/committer/txvalidator/mocks
43+
//go:generate mockery -dir . -name QueryExecutorCreator -case underscore -output mocks/
4444

4545
// QueryExecutorCreator creates new query executors
4646
type QueryExecutorCreator interface {
@@ -75,8 +75,8 @@ type PluginValidator struct {
7575
capabilities Capabilities
7676
}
7777

78-
// go:generate mockery -dir core/handlers/validation/api/capabilities/ -name Capabilities -case underscore -output core/committer/txvalidator/mocks/
79-
// go:generate mockery -dir msp/ -name IdentityDeserializer -case underscore -output core/committer/txvalidator/mocks
78+
//go:generate mockery -dir ../../handlers/validation/api/capabilities/ -name Capabilities -case underscore -output mocks/
79+
//go:generate mockery -dir ../../../msp/ -name IdentityDeserializer -case underscore -output mocks/
8080

8181
// NewPluginValidator creates a new PluginValidator
8282
func NewPluginValidator(pm PluginMapper, qec QueryExecutorCreator, deserializer msp.IdentityDeserializer, capabilities Capabilities) *PluginValidator {

0 commit comments

Comments
 (0)
Please sign in to comment.