Skip to content

Commit

Permalink
Merge "[FAB-3485] improve test coverage for msp/mgmt"
Browse files Browse the repository at this point in the history
  • Loading branch information
christo4ferris authored and Gerrit Code Review committed Apr 29, 2017
2 parents 11f34c6 + edd26e1 commit a0763aa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
9 changes: 0 additions & 9 deletions msp/mgmt/mgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,6 @@ func GetDeserializers() map[string]msp.IdentityDeserializer {
return clone
}

// GetManagerForChainIfExists returns the MSPManager associated to ChainID
// it it exists
func GetManagerForChainIfExists(ChainID string) msp.MSPManager {
m.Lock()
defer m.Unlock()

return mspMap[ChainID]
}

// XXXSetMSPManager is a stopgap solution to transition from the custom MSP config block
// parsing to the configtx.Manager interface, while preserving the problematic singleton
// nature of the MSP manager
Expand Down
14 changes: 14 additions & 0 deletions msp/mgmt/mgmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

configvaluesmsp "github.com/hyperledger/fabric/common/config/msp"
"github.com/hyperledger/fabric/msp"
"github.com/stretchr/testify/assert"
)

func TestGetManagerForChains(t *testing.T) {
Expand Down Expand Up @@ -54,3 +55,16 @@ func TestGetManagerForChains_usingMSPConfigHandlers(t *testing.T) {
t.FailNow()
}
}

func TestGetIdentityDeserializer(t *testing.T) {
XXXSetMSPManager("baz", &configvaluesmsp.MSPConfigHandler{MSPManager: msp.NewMSPManager()})
ids := GetIdentityDeserializer("baz")
assert.NotNil(t, ids)
ids = GetIdentityDeserializer("")
assert.NotNil(t, ids)
}

func TestGetLocalSigningIdentityOrPanic(t *testing.T) {
sid := GetLocalSigningIdentityOrPanic()
assert.NotNil(t, sid)
}

0 comments on commit a0763aa

Please sign in to comment.