Commit 003a6ef9 authored by Jason Yellick's avatar Jason Yellick
Browse files

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: default avatarJason Yellick <jyellick@us.ibm.com>
parent cee7e9b1
......@@ -39,7 +39,7 @@ type LifeCycleChangeListener interface {
// HandleMetadataUpdate is triggered upon a change in the chaincode lifecycle change
type HandleMetadataUpdate func(channel string, chaincodes chaincode.MetadataSet)
// go:generate mockery -dir core/cclifecycle -name LifeCycleChangeListener -case underscore -output core/cclifecycle/mocks/
//go:generate mockery -dir . -name LifeCycleChangeListener -case underscore -output mocks/
// LifeCycleChangeListener runs whenever there is a change to the metadata
// // of a chaincode in the context of a specific channel
......@@ -47,7 +47,7 @@ func (mdUpdate HandleMetadataUpdate) LifeCycleChangeListener(channel string, cha
mdUpdate(channel, chaincodes)
}
// go:generate mockery -dir core/cclifecycle -name Enumerator -case underscore -output core/cclifecycle/mocks/
//go:generate mockery -dir . -name Enumerator -case underscore -output mocks/
// Enumerator enumerates chaincodes
type Enumerator interface {
......@@ -63,7 +63,7 @@ func (listCCs Enumerate) Enumerate() ([]chaincode.InstalledChaincode, error) {
return listCCs()
}
// go:generate mockery -dir core/cclifecycle -name Query -case underscore -output core/cclifecycle/mocks/
//go:generate mockery -dir . -name Query -case underscore -output mocks/
// Query queries the state
type Query interface {
......@@ -74,7 +74,7 @@ type Query interface {
Done()
}
// go:generate mockery -dir core/cclifecycle -name QueryCreator -case underscore -output core/cclifecycle/mocks/
//go:generate mockery -dir . -name QueryCreator -case underscore -output mocks/
// QueryCreator creates queries
type QueryCreator interface {
......
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Code generated by mockery v1.0.0
package mocks
......
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Code generated by mockery v1.0.0
package mocks
......
......@@ -3,12 +3,6 @@ package mocks
import mock "github.com/stretchr/testify/mock"
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Query is an autogenerated mock type for the Query type
type Query struct {
mock.Mock
......
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Code generated by mockery v1.0.0
package mocks
......
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Code generated by mockery v1.0.0
package mocks
......
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Code generated by mockery v1.0.0
package mocks
......
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Code generated by mockery v1.0.0
package mocks
......
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Code generated by mockery v1.0.0
package mocks
......
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Code generated by mockery v1.0.0
package mocks
......
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Code generated by mockery v1.0.0
package mocks
......
......@@ -30,9 +30,9 @@ func (m MapBasedPluginMapper) PluginFactoryByName(name PluginName) validation.Pl
return m[string(name)]
}
// go:generate mockery -dir core/committer/txvalidator/ -name PluginMapper -case underscore -output core/committer/txvalidator/mocks
// go:generate mockery -dir core/handlers/validation/api/ -name PluginFactory -case underscore -output core/committer/txvalidator/mocks/
// go:generate mockery -dir core/handlers/validation/api/ -name Plugin -case underscore -output core/committer/txvalidator/mocks/
//go:generate mockery -dir . -name PluginMapper -case underscore -output mocks/
//go:generate mockery -dir ../../handlers/validation/api/ -name PluginFactory -case underscore -output mocks/
//go:generate mockery -dir ../../handlers/validation/api/ -name Plugin -case underscore -output mocks/
// PluginMapper maps plugin names to their corresponding factory instance.
// Returns nil if the name isn't associated to any plugin.
......@@ -40,7 +40,7 @@ type PluginMapper interface {
PluginFactoryByName(name PluginName) validation.PluginFactory
}
// go:generate mockery -dir core/committer/txvalidator/ -name QueryExecutorCreator -case underscore -output core/committer/txvalidator/mocks
//go:generate mockery -dir . -name QueryExecutorCreator -case underscore -output mocks/
// QueryExecutorCreator creates new query executors
type QueryExecutorCreator interface {
......@@ -75,8 +75,8 @@ type PluginValidator struct {
capabilities Capabilities
}
// go:generate mockery -dir core/handlers/validation/api/capabilities/ -name Capabilities -case underscore -output core/committer/txvalidator/mocks/
// go:generate mockery -dir msp/ -name IdentityDeserializer -case underscore -output core/committer/txvalidator/mocks
//go:generate mockery -dir ../../handlers/validation/api/capabilities/ -name Capabilities -case underscore -output mocks/
//go:generate mockery -dir ../../../msp/ -name IdentityDeserializer -case underscore -output mocks/
// NewPluginValidator creates a new PluginValidator
func NewPluginValidator(pm PluginMapper, qec QueryExecutorCreator, deserializer msp.IdentityDeserializer, capabilities Capabilities) *PluginValidator {
......
......@@ -2,7 +2,6 @@
package mock
import (
"io"
"sync"
container_test "github.com/hyperledger/fabric/core/container"
......@@ -11,21 +10,6 @@ import (
)
type VM struct {
DeployStub func(ctxt context.Context, ccid ccintf.CCID, args []string, env []string, reader io.Reader) error
deployMutex sync.RWMutex
deployArgsForCall []struct {
ctxt context.Context
ccid ccintf.CCID
args []string
env []string
reader io.Reader
}
deployReturns struct {
result1 error
}
deployReturnsOnCall map[int]struct {
result1 error
}
StartStub func(ctxt context.Context, ccid ccintf.CCID, args []string, env []string, filesToUpload map[string][]byte, builder container_test.Builder) error
startMutex sync.RWMutex
startArgsForCall []struct {
......@@ -57,97 +41,10 @@ type VM struct {
stopReturnsOnCall map[int]struct {
result1 error
}
DestroyStub func(ctxt context.Context, ccid ccintf.CCID, force bool, noprune bool) error
destroyMutex sync.RWMutex
destroyArgsForCall []struct {
ctxt context.Context
ccid ccintf.CCID
force bool
noprune bool
}
destroyReturns struct {
result1 error
}
destroyReturnsOnCall map[int]struct {
result1 error
}
GetVMNameStub func(ccID ccintf.CCID) string
getVMNameMutex sync.RWMutex
getVMNameArgsForCall []struct {
ccID ccintf.CCID
}
getVMNameReturns struct {
result1 string
}
getVMNameReturnsOnCall map[int]struct {
result1 string
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *VM) Deploy(ctxt context.Context, ccid ccintf.CCID, args []string, env []string, reader io.Reader) error {
var argsCopy []string
if args != nil {
argsCopy = make([]string, len(args))
copy(argsCopy, args)
}
var envCopy []string
if env != nil {
envCopy = make([]string, len(env))
copy(envCopy, env)
}
fake.deployMutex.Lock()
ret, specificReturn := fake.deployReturnsOnCall[len(fake.deployArgsForCall)]
fake.deployArgsForCall = append(fake.deployArgsForCall, struct {
ctxt context.Context
ccid ccintf.CCID
args []string
env []string
reader io.Reader
}{ctxt, ccid, argsCopy, envCopy, reader})
fake.recordInvocation("Deploy", []interface{}{ctxt, ccid, argsCopy, envCopy, reader})
fake.deployMutex.Unlock()
if fake.DeployStub != nil {
return fake.DeployStub(ctxt, ccid, args, env, reader)
}
if specificReturn {
return ret.result1
}
return fake.deployReturns.result1
}
func (fake *VM) DeployCallCount() int {
fake.deployMutex.RLock()
defer fake.deployMutex.RUnlock()
return len(fake.deployArgsForCall)
}
func (fake *VM) DeployArgsForCall(i int) (context.Context, ccintf.CCID, []string, []string, io.Reader) {
fake.deployMutex.RLock()
defer fake.deployMutex.RUnlock()
return fake.deployArgsForCall[i].ctxt, fake.deployArgsForCall[i].ccid, fake.deployArgsForCall[i].args, fake.deployArgsForCall[i].env, fake.deployArgsForCall[i].reader
}
func (fake *VM) DeployReturns(result1 error) {
fake.DeployStub = nil
fake.deployReturns = struct {
result1 error
}{result1}
}
func (fake *VM) DeployReturnsOnCall(i int, result1 error) {
fake.DeployStub = nil
if fake.deployReturnsOnCall == nil {
fake.deployReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.deployReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *VM) Start(ctxt context.Context, ccid ccintf.CCID, args []string, env []string, filesToUpload map[string][]byte, builder container_test.Builder) error {
var argsCopy []string
if args != nil {
......@@ -263,118 +160,13 @@ func (fake *VM) StopReturnsOnCall(i int, result1 error) {
}{result1}
}
func (fake *VM) Destroy(ctxt context.Context, ccid ccintf.CCID, force bool, noprune bool) error {
fake.destroyMutex.Lock()
ret, specificReturn := fake.destroyReturnsOnCall[len(fake.destroyArgsForCall)]
fake.destroyArgsForCall = append(fake.destroyArgsForCall, struct {
ctxt context.Context
ccid ccintf.CCID
force bool
noprune bool
}{ctxt, ccid, force, noprune})
fake.recordInvocation("Destroy", []interface{}{ctxt, ccid, force, noprune})
fake.destroyMutex.Unlock()
if fake.DestroyStub != nil {
return fake.DestroyStub(ctxt, ccid, force, noprune)
}
if specificReturn {
return ret.result1
}
return fake.destroyReturns.result1
}
func (fake *VM) DestroyCallCount() int {
fake.destroyMutex.RLock()
defer fake.destroyMutex.RUnlock()
return len(fake.destroyArgsForCall)
}
func (fake *VM) DestroyArgsForCall(i int) (context.Context, ccintf.CCID, bool, bool) {
fake.destroyMutex.RLock()
defer fake.destroyMutex.RUnlock()
return fake.destroyArgsForCall[i].ctxt, fake.destroyArgsForCall[i].ccid, fake.destroyArgsForCall[i].force, fake.destroyArgsForCall[i].noprune
}
func (fake *VM) DestroyReturns(result1 error) {
fake.DestroyStub = nil
fake.destroyReturns = struct {
result1 error
}{result1}
}
func (fake *VM) DestroyReturnsOnCall(i int, result1 error) {
fake.DestroyStub = nil
if fake.destroyReturnsOnCall == nil {
fake.destroyReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.destroyReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *VM) GetVMName(ccID ccintf.CCID) string {
fake.getVMNameMutex.Lock()
ret, specificReturn := fake.getVMNameReturnsOnCall[len(fake.getVMNameArgsForCall)]
fake.getVMNameArgsForCall = append(fake.getVMNameArgsForCall, struct {
ccID ccintf.CCID
}{ccID})
fake.recordInvocation("GetVMName", []interface{}{ccID})
fake.getVMNameMutex.Unlock()
if fake.GetVMNameStub != nil {
return fake.GetVMNameStub(ccID)
}
if specificReturn {
return ret.result1
}
return fake.getVMNameReturns.result1
}
func (fake *VM) GetVMNameCallCount() int {
fake.getVMNameMutex.RLock()
defer fake.getVMNameMutex.RUnlock()
return len(fake.getVMNameArgsForCall)
}
func (fake *VM) GetVMNameArgsForCall(i int) ccintf.CCID {
fake.getVMNameMutex.RLock()
defer fake.getVMNameMutex.RUnlock()
return fake.getVMNameArgsForCall[i].ccID
}
func (fake *VM) GetVMNameReturns(result1 string) {
fake.GetVMNameStub = nil
fake.getVMNameReturns = struct {
result1 string
}{result1}
}
func (fake *VM) GetVMNameReturnsOnCall(i int, result1 string) {
fake.GetVMNameStub = nil
if fake.getVMNameReturnsOnCall == nil {
fake.getVMNameReturnsOnCall = make(map[int]struct {
result1 string
})
}
fake.getVMNameReturnsOnCall[i] = struct {
result1 string
}{result1}
}
func (fake *VM) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.deployMutex.RLock()
defer fake.deployMutex.RUnlock()
fake.startMutex.RLock()
defer fake.startMutex.RUnlock()
fake.stopMutex.RLock()
defer fake.stopMutex.RUnlock()
fake.destroyMutex.RLock()
defer fake.destroyMutex.RUnlock()
fake.getVMNameMutex.RLock()
defer fake.getVMNameMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
......
/*
Copyright IBM Corp. 2016 All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Code generated by mockery v1.0.0
package mocks
......
/*
Copyright IBM Corp. 2016 All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Code generated by mockery v1.0.0
package mocks
......
/*
Copyright IBM Corp. 2016 All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Code generated by mockery v1.0.0
package mocks
......
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Code generated by mockery v1.0.0
package mocks
......
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Code generated by mockery v1.0.0
package mocks
......
......@@ -19,22 +19,22 @@ import (
"github.com/pkg/errors"
)
// go:generate mockery -dir core/endorser/ -name TransientStoreRetriever -case underscore -output core/endorser/mocks/
// go:generate mockery -dir core/transientstore/ -name Store -case underscore -output core/endorser/mocks/
//go:generate mockery -dir . -name TransientStoreRetriever -case underscore -output mocks/
//go:generate mockery -dir ../transientstore/ -name Store -case underscore -output mocks/
// TransientStoreRetriever retrieves transient stores
type TransientStoreRetriever interface {
// StoreForChannel returns the transient store for the given channel
StoreForChannel(channel string) transientstore.Store
}
// go:generate mockery -dir core/endorser/ -name ChannelStateRetriever -case underscore -output core/endorser/mocks/
//go:generate mockery -dir . -name ChannelStateRetriever -case underscore -output mocks/
// ChannelStateRetriever retrieves Channel state
type ChannelStateRetriever interface {
// ChannelState returns a QueryCreator for the given Channel
NewQueryCreator(channel string) (QueryCreator, error)
}
// go:generate mockery -dir core/endorser/ -name PluginMapper -case underscore -output core/endorser/mocks/
//go:generate mockery -dir . -name PluginMapper -case underscore -output mocks/
// PluginMapper maps plugin names to their corresponding factories
type PluginMapper interface {
PluginFactoryByName(name PluginName) endorsement.PluginFactory
......
......@@ -14,7 +14,7 @@ import (
"github.com/pkg/errors"
)
// go:generate mockery -dir core/endorser/ -name QueryCreator -case underscore -output core/endorser/mocks/
//go:generate mockery -dir . -name QueryCreator -case underscore -output mocks/
// QueryCreator creates new QueryExecutors
type QueryCreator interface {
NewQueryExecutor() (ledger.QueryExecutor, error)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment