Skip to content

Commit edd26e1

Browse files
committed
[FAB-3485] improve test coverage for msp/mgmt
Test output for msp/mgmt now is coverage: 87.8% of statements ok github.com/hyperledger/fabric/msp/mgmt 0.033s Change-Id: I6d34b9cf914d970b9a57de214cb4881c95fdbf13 Signed-off-by: Alessandro Sorniotti <[email protected]>
1 parent fa389de commit edd26e1

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

msp/mgmt/mgmt.go

-9
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,6 @@ func GetDeserializers() map[string]msp.IdentityDeserializer {
113113
return clone
114114
}
115115

116-
// GetManagerForChainIfExists returns the MSPManager associated to ChainID
117-
// it it exists
118-
func GetManagerForChainIfExists(ChainID string) msp.MSPManager {
119-
m.Lock()
120-
defer m.Unlock()
121-
122-
return mspMap[ChainID]
123-
}
124-
125116
// XXXSetMSPManager is a stopgap solution to transition from the custom MSP config block
126117
// parsing to the configtx.Manager interface, while preserving the problematic singleton
127118
// nature of the MSP manager

msp/mgmt/mgmt_test.go

+14
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121

2222
configvaluesmsp "github.com/hyperledger/fabric/common/config/msp"
2323
"github.com/hyperledger/fabric/msp"
24+
"github.com/stretchr/testify/assert"
2425
)
2526

2627
func TestGetManagerForChains(t *testing.T) {
@@ -54,3 +55,16 @@ func TestGetManagerForChains_usingMSPConfigHandlers(t *testing.T) {
5455
t.FailNow()
5556
}
5657
}
58+
59+
func TestGetIdentityDeserializer(t *testing.T) {
60+
XXXSetMSPManager("baz", &configvaluesmsp.MSPConfigHandler{MSPManager: msp.NewMSPManager()})
61+
ids := GetIdentityDeserializer("baz")
62+
assert.NotNil(t, ids)
63+
ids = GetIdentityDeserializer("")
64+
assert.NotNil(t, ids)
65+
}
66+
67+
func TestGetLocalSigningIdentityOrPanic(t *testing.T) {
68+
sid := GetLocalSigningIdentityOrPanic()
69+
assert.NotNil(t, sid)
70+
}

0 commit comments

Comments
 (0)