From 9a5049cf9e8d342e7f4e77c95179b5bce9315d45 Mon Sep 17 00:00:00 2001 From: Gregory Haskins Date: Fri, 14 Apr 2017 16:38:52 -0400 Subject: [PATCH] [FAB-3160] Move core/config to core/testutil This will pave the way for avoiding a circular reference once we add the real support for config-relative pathing as part of FAB-3160 Change-Id: Ie01790862f0945816e74ca263ef96d342d3506be Signed-off-by: Greg Haskins --- core/chaincode/platforms/car/test/platform_test.go | 4 ++-- core/chaincode/platforms/java/test/java_test.go | 4 ++-- core/comm/connection_test.go | 6 +++--- core/container/dockercontroller/dockercontroller_test.go | 6 +++--- core/{config => testutil}/config.go | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) rename core/{config => testutil}/config.go (99%) diff --git a/core/chaincode/platforms/car/test/platform_test.go b/core/chaincode/platforms/car/test/platform_test.go index c0abc22b99f..dfc7a45b364 100644 --- a/core/chaincode/platforms/car/test/platform_test.go +++ b/core/chaincode/platforms/car/test/platform_test.go @@ -21,13 +21,13 @@ import ( "testing" "github.com/hyperledger/fabric/common/util" - "github.com/hyperledger/fabric/core/config" "github.com/hyperledger/fabric/core/container" + "github.com/hyperledger/fabric/core/testutil" pb "github.com/hyperledger/fabric/protos/peer" ) func TestMain(m *testing.M) { - config.SetupTestConfig("../../../../../peer") + testutil.SetupTestConfig("../../../../../peer") os.Exit(m.Run()) } diff --git a/core/chaincode/platforms/java/test/java_test.go b/core/chaincode/platforms/java/test/java_test.go index 36dcbd11b0f..0db93e97e6c 100644 --- a/core/chaincode/platforms/java/test/java_test.go +++ b/core/chaincode/platforms/java/test/java_test.go @@ -21,13 +21,13 @@ import ( "testing" "github.com/hyperledger/fabric/common/util" - "github.com/hyperledger/fabric/core/config" "github.com/hyperledger/fabric/core/container" + "github.com/hyperledger/fabric/core/testutil" pb "github.com/hyperledger/fabric/protos/peer" ) func TestMain(m *testing.M) { - config.SetupTestConfig("../../../../../peer") + testutil.SetupTestConfig("../../../../../peer") os.Exit(m.Run()) } diff --git a/core/comm/connection_test.go b/core/comm/connection_test.go index ac56e48085b..3f04a248e75 100644 --- a/core/comm/connection_test.go +++ b/core/comm/connection_test.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/viper" - "github.com/hyperledger/fabric/core/config" + "github.com/hyperledger/fabric/core/testutil" "github.com/stretchr/testify/assert" "google.golang.org/grpc" ) @@ -52,7 +52,7 @@ VQQLDAtIeXBlcmxlZGdlcjESMBAGA1UEAwwJbG9jYWxob3N0MFkwEwYHKoZIzj0C ` func TestConnection_Correct(t *testing.T) { - config.SetupTestConfig("./../../peer") + testutil.SetupTestConfig("./../../peer") viper.Set("ledger.blockchain.deploy-system-chaincode", "false") peerAddress := GetPeerTestingAddress("7051") var tmpConn *grpc.ClientConn @@ -69,7 +69,7 @@ func TestConnection_Correct(t *testing.T) { } func TestConnection_WrongAddress(t *testing.T) { - config.SetupTestConfig("./../../peer") + testutil.SetupTestConfig("./../../peer") viper.Set("ledger.blockchain.deploy-system-chaincode", "false") peerAddress := GetPeerTestingAddress("7052") var tmpConn *grpc.ClientConn diff --git a/core/container/dockercontroller/dockercontroller_test.go b/core/container/dockercontroller/dockercontroller_test.go index 0c8b02ffdda..4772f6d3865 100644 --- a/core/container/dockercontroller/dockercontroller_test.go +++ b/core/container/dockercontroller/dockercontroller_test.go @@ -25,11 +25,11 @@ import ( "github.com/spf13/viper" "github.com/hyperledger/fabric/common/ledger/testutil" - "github.com/hyperledger/fabric/core/config" + coreutil "github.com/hyperledger/fabric/core/testutil" ) func TestHostConfig(t *testing.T) { - config.SetupTestConfig("./../../../peer") + coreutil.SetupTestConfig("./../../../peer") var hostConfig = new(docker.HostConfig) err := viper.UnmarshalKey("vm.docker.hostConfig", hostConfig) if err != nil { @@ -44,7 +44,7 @@ func TestHostConfig(t *testing.T) { func TestGetDockerHostConfig(t *testing.T) { os.Setenv("HYPERLEDGER_VM_DOCKER_HOSTCONFIG_NETWORKMODE", "overlay") os.Setenv("HYPERLEDGER_VM_DOCKER_HOSTCONFIG_CPUSHARES", fmt.Sprint(1024*1024*1024*2)) - config.SetupTestConfig("./../../../peer") + coreutil.SetupTestConfig("./../../../peer") hostConfig := getDockerHostConfig() testutil.AssertNotNil(t, hostConfig) testutil.AssertEquals(t, hostConfig.NetworkMode, "overlay") diff --git a/core/config/config.go b/core/testutil/config.go similarity index 99% rename from core/config/config.go rename to core/testutil/config.go index a453f2d1e70..c1122b35eae 100644 --- a/core/config/config.go +++ b/core/testutil/config.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package config +package testutil import ( "flag"