Skip to content

Commit

Permalink
[FAB-2651] Single path to unit-testing keystore
Browse files Browse the repository at this point in the history
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 <harrijk63@gmail.com>
  • Loading branch information
John Harrison committed Mar 18, 2017
1 parent 22c1a1f commit 8a5a5bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion core/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package config
import (
"flag"
"fmt"
"io/ioutil"
"runtime"
"strings"

Expand Down Expand Up @@ -84,7 +85,12 @@ func SetupTestConfig(pathToOpenchainYaml string) {
bccspConfig = nil
}

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

msp.SetupBCCSPKeystoreConfig(bccspConfig, tmpKeyStore)

err = factory.InitFactories(bccspConfig)
if err != nil {
Expand Down
8 changes: 7 additions & 1 deletion events/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package events
import (
"flag"
"fmt"
"io/ioutil"
"runtime"
"strings"

Expand Down Expand Up @@ -75,7 +76,12 @@ func SetupTestConfig() {
bccspConfig = nil
}

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

msp.SetupBCCSPKeystoreConfig(bccspConfig, tmpKeyStore)

err = factory.InitFactories(bccspConfig)
if err != nil {
Expand Down

0 comments on commit 8a5a5bc

Please sign in to comment.