Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 3ce407e

Browse files
committed
[FAB-8939] Organize generated mock directories
This change removes underscores from the generated mocks. It also organizes these packages under test folders with the prefix mock. Change-Id: I7e76eb19d3561eb041caf8380c39392a6ea9e432 Signed-off-by: Troy Ronda <troy@troyronda.com>
1 parent e131b61 commit 3ce407e

File tree

64 files changed

+136
-136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+136
-136
lines changed

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,12 @@ dockerenv-latest-up: clean
339339

340340
.PHONY: mock-gen
341341
mock-gen:
342-
mockgen -build_flags '$(GO_LDFLAGS_ARG)' -package mocks github.com/hyperledger/fabric-sdk-go/pkg/common/providers/core Config,Providers | sed "s/github.com\/hyperledger\/fabric-sdk-go\/vendor\///g" | goimports > pkg/common/providers/core/mocks/mockcoreapi.gen.go
343-
mockgen -build_flags '$(GO_LDFLAGS_ARG)' github.com/hyperledger/fabric-sdk-go/pkg/common/providers/msp IdentityManager,Providers | sed "s/github.com\/hyperledger\/fabric-sdk-go\/vendor\///g" | goimports > pkg/common/providers/msp/mocks/mockmspapi.gen.go
344-
mockgen -build_flags '$(GO_LDFLAGS_ARG)' github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab ProposalProcessor,Providers | sed "s/github.com\/hyperledger\/fabric-sdk-go\/vendor\///g" | goimports > pkg/common/providers/fab/mocks/mockfabapi.gen.go
345-
mockgen -build_flags '$(GO_LDFLAGS_ARG)' github.com/hyperledger/fabric-sdk-go/pkg/common/providers/context Providers,Client | sed "s/github.com\/hyperledger\/fabric-sdk-go\/vendor\///g" | goimports > pkg/common/providers/context/mocks/mockcontext.gen.go
346-
mockgen -build_flags '$(GO_LDFLAGS_ARG)' github.com/hyperledger/fabric-sdk-go/pkg/fabsdk/api CoreProviderFactory,MSPProviderFactory,ServiceProviderFactory | sed "s/github.com\/hyperledger\/fabric-sdk-go\/vendor\///g" | goimports > pkg/fabsdk/mocks/mockfabsdkapi.gen.go
347-
mockgen -build_flags '$(GO_LDFLAGS_ARG)' github.com/hyperledger/fabric-sdk-go/pkg/msp/api CAClient | sed "s/github.com\/hyperledger\/fabric-sdk-go\/vendor\///g" | goimports > pkg/msp/api/mocks/mockmspapi.gen.go
342+
mockgen -build_flags '$(GO_LDFLAGS_ARG)' -package mockcore github.com/hyperledger/fabric-sdk-go/pkg/common/providers/core Config,Providers | sed "s/github.com\/hyperledger\/fabric-sdk-go\/vendor\///g" | goimports > pkg/common/providers/test/mockcore/mockcore.gen.go
343+
mockgen -build_flags '$(GO_LDFLAGS_ARG)' -package mockmsp github.com/hyperledger/fabric-sdk-go/pkg/common/providers/msp IdentityManager,Providers | sed "s/github.com\/hyperledger\/fabric-sdk-go\/vendor\///g" | goimports > pkg/common/providers/test/mockmsp/mockmsp.gen.go
344+
mockgen -build_flags '$(GO_LDFLAGS_ARG)' -package mockfab github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab ProposalProcessor,Providers | sed "s/github.com\/hyperledger\/fabric-sdk-go\/vendor\///g" | goimports > pkg/common/providers/test/mockfab/mockfab.gen.go
345+
mockgen -build_flags '$(GO_LDFLAGS_ARG)' -package mockcontext github.com/hyperledger/fabric-sdk-go/pkg/common/providers/context Providers,Client | sed "s/github.com\/hyperledger\/fabric-sdk-go\/vendor\///g" | goimports > pkg/common/providers/test/mockcontext/mockcontext.gen.go
346+
mockgen -build_flags '$(GO_LDFLAGS_ARG)' -package mocksdkapi github.com/hyperledger/fabric-sdk-go/pkg/fabsdk/api CoreProviderFactory,MSPProviderFactory,ServiceProviderFactory | sed "s/github.com\/hyperledger\/fabric-sdk-go\/vendor\///g" | goimports > pkg/fabsdk/test/mocksdkapi/mocksdkapi.gen.go
347+
mockgen -build_flags '$(GO_LDFLAGS_ARG)' -package mockmspapi github.com/hyperledger/fabric-sdk-go/pkg/msp/api CAClient | sed "s/github.com\/hyperledger\/fabric-sdk-go\/vendor\///g" | goimports > pkg/msp/test/mockmspapi/mockmspapi.gen.go
348348

349349
# TODO - Add cryptogen
350350
.PHONY: channel-config-gen

pkg/client/channel/api_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/core"
1515
fcmocks "github.com/hyperledger/fabric-sdk-go/pkg/fab/mocks"
16-
mspmocks "github.com/hyperledger/fabric-sdk-go/pkg/msp/mocks"
16+
mspmocks "github.com/hyperledger/fabric-sdk-go/pkg/msp/test/mockmsp"
1717
"github.com/stretchr/testify/assert"
1818
)
1919

pkg/client/channel/chclient_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
fcmocks "github.com/hyperledger/fabric-sdk-go/pkg/fab/mocks"
2525
"github.com/hyperledger/fabric-sdk-go/pkg/fab/peer"
2626
"github.com/hyperledger/fabric-sdk-go/pkg/fab/txn"
27-
mspmocks "github.com/hyperledger/fabric-sdk-go/pkg/msp/mocks"
27+
mspmocks "github.com/hyperledger/fabric-sdk-go/pkg/msp/test/mockmsp"
2828
"github.com/hyperledger/fabric-sdk-go/pkg/util/errors/retry"
2929
"github.com/hyperledger/fabric-sdk-go/pkg/util/errors/status"
3030
"github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/common"
@@ -208,7 +208,7 @@ func TestExecuteTx(t *testing.T) {
208208
assert.True(t, ok, "expected status error")
209209
assert.EqualValues(t, status.EndorsementMismatch.ToInt32(), s.Code, "expected mismatch error")
210210

211-
// TODO: Test Valid Scenario with mocks
211+
// TODO: Test Valid Scenario with mockcore
212212

213213
}
214214

@@ -524,7 +524,7 @@ func setupCustomTestContext(t *testing.T, selectionService fab.SelectionService,
524524
testChannelSvc, err := setupTestChannelService(ctx, orderers)
525525
assert.Nil(t, err, "Got error %s", err)
526526

527-
//Modify for custom mocks to test scenarios
527+
//Modify for custom mockcore to test scenarios
528528
selectionProvider := ctx.MockProviderContext.SelectionProvider()
529529
selectionProvider.(*fcmocks.MockSelectionProvider).SetCustomSelectionService(selectionService)
530530

pkg/client/channel/invoke/txnhandler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/core"
2121
"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab"
2222
fcmocks "github.com/hyperledger/fabric-sdk-go/pkg/fab/mocks"
23-
mspmocks "github.com/hyperledger/fabric-sdk-go/pkg/msp/mocks"
23+
mspmocks "github.com/hyperledger/fabric-sdk-go/pkg/msp/test/mockmsp"
2424
pb "github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/peer"
2525
)
2626

pkg/client/common/mocks/mockselection.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func (dp *MockSelectionProvider) CreateSelectionService(channelID string) (*Mock
3737
return &MockSelectionService{Error: dp.Error, Peers: dp.Peers}, nil
3838
}
3939

40-
// GetEndorsersForChaincode mocks retrieving endorsing peers
40+
// GetEndorsersForChaincode mockcore retrieving endorsing peers
4141
func (ds *MockSelectionService) GetEndorsersForChaincode(chaincodeIDs []string, opts ...options.Opt) ([]fab.Peer, error) {
4242

4343
if ds.Error != nil {

pkg/client/common/selection/dynamicselection/dynamicselection_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"github.com/hyperledger/fabric-sdk-go/pkg/fab/mocks"
2222
"github.com/hyperledger/fabric-sdk-go/pkg/fabsdk"
2323
"github.com/hyperledger/fabric-sdk-go/pkg/fabsdk/factory/defsvc"
24-
mspmocks "github.com/hyperledger/fabric-sdk-go/pkg/msp/mocks"
24+
mspmocks "github.com/hyperledger/fabric-sdk-go/pkg/msp/test/mockmsp"
2525
"github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/core/common/ccprovider"
2626
"github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/common"
2727
)

pkg/client/common/selection/staticselection/staticselection_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/context"
1616
"github.com/hyperledger/fabric-sdk-go/pkg/core/config"
1717
fabmocks "github.com/hyperledger/fabric-sdk-go/pkg/fab/mocks"
18-
mspmocks "github.com/hyperledger/fabric-sdk-go/pkg/msp/mocks"
18+
mspmocks "github.com/hyperledger/fabric-sdk-go/pkg/msp/test/mockmsp"
1919
)
2020

2121
type serviceInit interface {

pkg/client/ledger/opts_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/core"
1414
fcmocks "github.com/hyperledger/fabric-sdk-go/pkg/fab/mocks"
15-
mspmocks "github.com/hyperledger/fabric-sdk-go/pkg/msp/mocks"
15+
mspmocks "github.com/hyperledger/fabric-sdk-go/pkg/msp/test/mockmsp"
1616
"github.com/stretchr/testify/assert"
1717
)
1818

pkg/client/msp/client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/core"
2121
"github.com/hyperledger/fabric-sdk-go/pkg/core/config"
2222
"github.com/hyperledger/fabric-sdk-go/pkg/fabsdk"
23-
"github.com/hyperledger/fabric-sdk-go/pkg/msp/mocks"
23+
"github.com/hyperledger/fabric-sdk-go/pkg/msp/test/mockmsp"
2424
)
2525

2626
const (
@@ -137,7 +137,7 @@ type textFixture struct {
137137
config core.Config
138138
}
139139

140-
var caServer = &mocks.MockFabricCAServer{}
140+
var caServer = &mockmsp.MockFabricCAServer{}
141141

142142
func (f *textFixture) setup() *fabsdk.FabricSDK {
143143

pkg/client/resmgmt/resmgmt_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
"github.com/hyperledger/fabric-sdk-go/pkg/fab/peer"
3232
"github.com/hyperledger/fabric-sdk-go/pkg/fab/resource/api"
3333
"github.com/hyperledger/fabric-sdk-go/pkg/fabsdk/provider/fabpvdr"
34-
mspmocks "github.com/hyperledger/fabric-sdk-go/pkg/msp/mocks"
34+
mspmocks "github.com/hyperledger/fabric-sdk-go/pkg/msp/test/mockmsp"
3535
"github.com/hyperledger/fabric-sdk-go/pkg/util/errors/status"
3636
"github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/common/cauthdsl"
3737
"github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/common"

0 commit comments

Comments
 (0)