Skip to content

Commit

Permalink
[FAB-10455] Clean up user store after test completion
Browse files Browse the repository at this point in the history
Change-Id: I497d79fc8953d504d96d79c59e735675d84f0257
Signed-off-by: Divyank Katira <Divyank.Katira@securekey.com>
  • Loading branch information
d1vyank committed May 29, 2018
1 parent f3528ca commit c83d774
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions test/integration/msp/identity_test.go
Expand Up @@ -20,7 +20,8 @@ import (

func TestIdentity(t *testing.T) {

mspClient := setupClient(t)
mspClient, sdk := setupClient(t)
defer integration.CleanupUserData(t, sdk)

// Generate a random user name
username := integration.GenerateRandomID()
Expand Down Expand Up @@ -86,7 +87,8 @@ func TestIdentity(t *testing.T) {

func TestUpdateIdentity(t *testing.T) {

mspClient := setupClient(t)
mspClient, sdk := setupClient(t)
defer integration.CleanupUserData(t, sdk)

// Generate a random user name
username := integration.GenerateRandomID()
Expand Down Expand Up @@ -158,7 +160,8 @@ func TestUpdateIdentity(t *testing.T) {
}
func TestGetAllIdentities(t *testing.T) {

mspClient := setupClient(t)
mspClient, sdk := setupClient(t)
defer integration.CleanupUserData(t, sdk)

testAttributes := []msp.Attribute{
{
Expand Down Expand Up @@ -232,7 +235,7 @@ func containsIdentity(identities []*msp.IdentityResponse, request *msp.IdentityR
return false
}

func setupClient(t *testing.T) *msp.Client {
func setupClient(t *testing.T) (*msp.Client, *fabsdk.FabricSDK) {

// Instantiate the SDK
sdk, err := fabsdk.New(integration.ConfigBackend)
Expand All @@ -244,7 +247,6 @@ func setupClient(t *testing.T) *msp.Client {
// Delete all private keys from the crypto suite store
// and users from the user store at the end
integration.CleanupUserData(t, sdk)
defer integration.CleanupUserData(t, sdk)

ctxProvider := sdk.Context()

Expand Down Expand Up @@ -272,7 +274,7 @@ func setupClient(t *testing.T) *msp.Client {
// (state store). The CAClient will lookup the
// registrar's identity information in these stores.

return mspClient
return mspClient, sdk

}

Expand Down

0 comments on commit c83d774

Please sign in to comment.