Skip to content

Commit

Permalink
[FAB-3160] Move core/config to core/testutil
Browse files Browse the repository at this point in the history
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 <gregory.haskins@gmail.com>
  • Loading branch information
ghaskins committed Apr 14, 2017
1 parent bd14ee7 commit 9a5049c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions core/chaincode/platforms/car/test/platform_test.go
Expand Up @@ -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())
}

Expand Down
4 changes: 2 additions & 2 deletions core/chaincode/platforms/java/test/java_test.go
Expand Up @@ -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())
}

Expand Down
6 changes: 3 additions & 3 deletions core/comm/connection_test.go
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions core/container/dockercontroller/dockercontroller_test.go
Expand Up @@ -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 {
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion core/config/config.go → core/testutil/config.go
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package config
package testutil

import (
"flag"
Expand Down

0 comments on commit 9a5049c

Please sign in to comment.