Skip to content

Commit

Permalink
[FAB-5136] Viper shouldn't be exposed in interface
Browse files Browse the repository at this point in the history
Change-Id: I52bf367ed711daa4e5fb8ede47413bbcf5e83ae3
Signed-off-by: Troy Ronda <[email protected]>
  • Loading branch information
troyronda committed Jun 30, 2017
1 parent f7b2f4f commit cb15534
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
2 changes: 0 additions & 2 deletions api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"crypto/x509"

bccspFactory "github.com/hyperledger/fabric/bccsp/factory"
"github.com/spf13/viper"
)

// Config fabric-sdk-go configuration interface
Expand All @@ -20,7 +19,6 @@ type Config interface {
CAClientKeyFile(org string) (string, error)
CAClientCertFile(org string) (string, error)
MspID(org string) (string, error)
FabricClientViper() *viper.Viper
OrderersConfig() ([]OrdererConfig, error)
RandomOrdererConfig() (*OrdererConfig, error)
OrdererConfig(name string) (*OrdererConfig, error)
Expand Down
4 changes: 0 additions & 4 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ func TestCAConfigFailsByNetworkConfig(t *testing.T) {

//Tamper 'client.network' value and use a new config to avoid conflicting with other tests
sampleConfig, err := InitConfig("../../test/fixtures/config/config_test.yaml")
myViper := sampleConfig.FabricClientViper()
clientNetworks := myViper.Get("client.network")
myViper.Set("client.network", "INVALID")
//...
Expand Down Expand Up @@ -314,16 +313,13 @@ func TestInitConfig(t *testing.T) {
}

//Test if Viper is initialized after calling init config
myViper := configImpl.FabricClientViper()

if myViper.GetString("client.security.hashAlgorithm") != configImpl.SecurityAlgorithm() {
t.Fatal("Config initialized with incorrect viper configuration")
}

}

func TestInitConfigPanic(t *testing.T) {
myViper := configImpl.FabricClientViper()
existingLogLevel := myViper.Get("client.logging.level")
myViper.Set("client.logging.level", "INVALID")

Expand Down

0 comments on commit cb15534

Please sign in to comment.