Skip to content

Commit

Permalink
Merge changes from topic "kill-common-mocks"
Browse files Browse the repository at this point in the history
* changes:
  FAB-16437 Remove common/mocks/policies
  FAB-16437 Remove common/mocks/msp
  • Loading branch information
mastersingh24 authored and Gerrit Code Review committed Nov 12, 2019
2 parents cd8c374 + f62a2c0 commit f4c7914
Show file tree
Hide file tree
Showing 21 changed files with 1,659 additions and 364 deletions.
795 changes: 795 additions & 0 deletions common/ledger/testutil/fakes/signing_identity.go

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions common/ledger/testutil/test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import (
"github.com/hyperledger/fabric/bccsp/sw"
"github.com/hyperledger/fabric/common/configtx/test"
"github.com/hyperledger/fabric/common/crypto"
mmsp "github.com/hyperledger/fabric/common/mocks/msp"

"github.com/hyperledger/fabric/common/ledger/testutil/fakes"
lutils "github.com/hyperledger/fabric/core/ledger/util"
"github.com/hyperledger/fabric/msp"
mspmgmt "github.com/hyperledger/fabric/msp/mgmt"
Expand Down Expand Up @@ -64,6 +65,12 @@ type BlockDetails struct {
Txs []*TxDetails
}

//go:generate counterfeiter -o fakes/signing_identity.go --fake-name SigningIdentity . signingIdentity

type signingIdentity interface {
msp.SigningIdentity
}

// NewBlockGenerator instantiates new BlockGenerator for testing
func NewBlockGenerator(t *testing.T, ledgerID string, signTxs bool) (*BlockGenerator, *common.Block) {
gb, err := test.MakeGenesisBlock(ledgerID)
Expand Down Expand Up @@ -360,8 +367,8 @@ func ConstructUnsignedTxEnv(
visibility []byte,
headerType common.HeaderType,
) (*common.Envelope, string, error) {
mspLcl := mmsp.NewNoopMsp()
sigId, _ := mspLcl.GetDefaultSigningIdentity()

sigId := &fakes.SigningIdentity{}

return ConstructSignedTxEnv(
chainID,
Expand Down
155 changes: 0 additions & 155 deletions common/mocks/msp/noopmsp.go

This file was deleted.

60 changes: 0 additions & 60 deletions common/mocks/msp/noopmsp_test.go

This file was deleted.

62 changes: 0 additions & 62 deletions common/mocks/policies/policies.go

This file was deleted.

31 changes: 0 additions & 31 deletions common/mocks/policies/policies_test.go

This file was deleted.

11 changes: 11 additions & 0 deletions core/chaincode/chaincode_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/hyperledger/fabric/common/channelconfig"
commonledger "github.com/hyperledger/fabric/common/ledger"
"github.com/hyperledger/fabric/common/policies"
"github.com/hyperledger/fabric/core/chaincode"
"github.com/hyperledger/fabric/core/common/privdata"
"github.com/hyperledger/fabric/core/container/ccintf"
Expand Down Expand Up @@ -135,3 +136,13 @@ type applicationCapabilities interface {
type applicationConfig interface {
channelconfig.Application
}

//go:generate counterfeiter -o mock/policy_manager.go -fake-name PolicyManager . policyManager
type policyManager interface {
policies.Manager
}

//go:generate counterfeiter -o mock/policy.go -fake-name Policy . policy
type policy interface {
policies.Policy
}
2 changes: 1 addition & 1 deletion core/chaincode/chaincode_support_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func initMockPeer(channelIDs ...string) (*peer.Peer, *ChaincodeSupport, func(),

globalBlockNum = make(map[string]uint64, len(channelIDs))
for _, id := range channelIDs {
if err := peer.CreateMockChannel(peerInstance, id); err != nil {
if err := peer.CreateMockChannel(peerInstance, id, &mock.PolicyManager{}); err != nil {
cleanup()
return nil, nil, func() {}, err
}
Expand Down
Loading

0 comments on commit f4c7914

Please sign in to comment.