Skip to content

Commit

Permalink
Merge "[FAB-2651] Single path to unit-testing keystore"
Browse files Browse the repository at this point in the history
  • Loading branch information
yacovm authored and Gerrit Code Review committed Mar 26, 2017
2 parents 582a5ec + 8a5a5bc commit 397f5de
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 397f5de

Please sign in to comment.