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

Commit c83d774

Browse files
committed
[FAB-10455] Clean up user store after test completion
Change-Id: I497d79fc8953d504d96d79c59e735675d84f0257 Signed-off-by: Divyank Katira <Divyank.Katira@securekey.com>
1 parent f3528ca commit c83d774

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/integration/msp/identity_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import (
2020

2121
func TestIdentity(t *testing.T) {
2222

23-
mspClient := setupClient(t)
23+
mspClient, sdk := setupClient(t)
24+
defer integration.CleanupUserData(t, sdk)
2425

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

8788
func TestUpdateIdentity(t *testing.T) {
8889

89-
mspClient := setupClient(t)
90+
mspClient, sdk := setupClient(t)
91+
defer integration.CleanupUserData(t, sdk)
9092

9193
// Generate a random user name
9294
username := integration.GenerateRandomID()
@@ -158,7 +160,8 @@ func TestUpdateIdentity(t *testing.T) {
158160
}
159161
func TestGetAllIdentities(t *testing.T) {
160162

161-
mspClient := setupClient(t)
163+
mspClient, sdk := setupClient(t)
164+
defer integration.CleanupUserData(t, sdk)
162165

163166
testAttributes := []msp.Attribute{
164167
{
@@ -232,7 +235,7 @@ func containsIdentity(identities []*msp.IdentityResponse, request *msp.IdentityR
232235
return false
233236
}
234237

235-
func setupClient(t *testing.T) *msp.Client {
238+
func setupClient(t *testing.T) (*msp.Client, *fabsdk.FabricSDK) {
236239

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

249251
ctxProvider := sdk.Context()
250252

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

275-
return mspClient
277+
return mspClient, sdk
276278

277279
}
278280

0 commit comments

Comments
 (0)