Skip to content

Commit 8a5a5bc

Browse files
author
John Harrison
committed
[FAB-2651] Single path to unit-testing keystore
https://jira.hyperledger.org/browse/FAB-2651 This patch updates the relative path to the keystore used by unit tests. A common location is now used for all unit tests. See JIRA for reasons this patch was created. Change-Id: I45db19e0f0bbf69c1a93d84fd6e9b5ba4e3b892c Signed-off-by: John Harrison <[email protected]>
1 parent 22c1a1f commit 8a5a5bc

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

core/config/config.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package config
1919
import (
2020
"flag"
2121
"fmt"
22+
"io/ioutil"
2223
"runtime"
2324
"strings"
2425

@@ -84,7 +85,12 @@ func SetupTestConfig(pathToOpenchainYaml string) {
8485
bccspConfig = nil
8586
}
8687

87-
msp.SetupBCCSPKeystoreConfig(bccspConfig, viper.GetString("peer.mspConfigPath")+"/keystore")
88+
tmpKeyStore, err := ioutil.TempDir("/tmp", "msp-keystore")
89+
if err != nil {
90+
panic(fmt.Errorf("Could not create temporary directory: %s\n", tmpKeyStore))
91+
}
92+
93+
msp.SetupBCCSPKeystoreConfig(bccspConfig, tmpKeyStore)
8894

8995
err = factory.InitFactories(bccspConfig)
9096
if err != nil {

events/config.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package events
1919
import (
2020
"flag"
2121
"fmt"
22+
"io/ioutil"
2223
"runtime"
2324
"strings"
2425

@@ -75,7 +76,12 @@ func SetupTestConfig() {
7576
bccspConfig = nil
7677
}
7778

78-
msp.SetupBCCSPKeystoreConfig(bccspConfig, viper.GetString("peer.mspConfigPath")+"/keystore")
79+
tmpKeyStore, err := ioutil.TempDir("/tmp", "msp-keystore")
80+
if err != nil {
81+
panic(fmt.Errorf("Could not create temporary directory: %s\n", tmpKeyStore))
82+
}
83+
84+
msp.SetupBCCSPKeystoreConfig(bccspConfig, tmpKeyStore)
7985

8086
err = factory.InitFactories(bccspConfig)
8187
if err != nil {

0 commit comments

Comments
 (0)