Skip to content

Commit

Permalink
Merge "Re-enable CAR test"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Yellick authored and Gerrit Code Review committed Feb 2, 2017
2 parents 25ffc3e + cfa02a4 commit b978f0d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 29 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ PKGNAME = github.com/$(PROJECT_NAME)
GO_LDFLAGS = -X $(PKGNAME)/common/metadata.Version=$(PROJECT_VERSION)
CGO_FLAGS = CGO_CFLAGS=" "
ARCH=$(shell uname -m)
CHAINTOOL_RELEASE=v0.10.0
CHAINTOOL_RELEASE=v0.10.1
BASEIMAGE_RELEASE=$(shell cat ./.baseimage-release)

CHAINTOOL_URL ?= https://github.com/hyperledger/fabric-chaintool/releases/download/$(CHAINTOOL_RELEASE)/chaintool

export GO_LDFLAGS

EXECUTABLES = go docker git curl
Expand Down Expand Up @@ -124,7 +126,7 @@ linter: testenv
%/chaintool: Makefile
@echo "Installing chaintool"
@mkdir -p $(@D)
curl -L https://github.com/hyperledger/fabric-chaintool/releases/download/$(CHAINTOOL_RELEASE)/chaintool > $@
curl -L $(CHAINTOOL_URL) > $@
chmod +x $@

# We (re)build a package within a docker context but persist the $GOPATH/pkg
Expand Down
50 changes: 23 additions & 27 deletions core/chaincode/platforms/car/test/car_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,34 @@ import (
"os"
"testing"

//"github.com/hyperledger/fabric/common/util"
"github.com/hyperledger/fabric/common/util"
"github.com/hyperledger/fabric/core/config"
//"github.com/hyperledger/fabric/core/container"
//pb "github.com/hyperledger/fabric/protos/peer"
"github.com/hyperledger/fabric/core/container"
pb "github.com/hyperledger/fabric/protos/peer"
)

func TestMain(m *testing.M) {
config.SetupTestConfig("../../../../../peer")
os.Exit(m.Run())
}

// Disable this for change chaincode interface temporarily.
// TODO: Update java chaincode interface and enable this.
//func TestCar_BuildImage(t *testing.T) {
// //Skipping the test till chaintool is fixed for changint CtorMsg to Input
// t.Skip()
// vm, err := container.NewVM()

// if err != nil {
// t.Errorf("Error getting VM: %s", err)
// return
// }
// // Build the spec
// cwd, err := os.Getwd()
// if err != nil {
// t.Errorf("Error getting CWD: %s", err)
// return
// }

// chaincodePath := cwd + "/org.hyperledger.chaincode.example02-0.1-SNAPSHOT.car"
// spec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_CAR, ChaincodeID: &pb.ChaincodeID{Name: "cartest", Path: chaincodePath}, Input: &pb.ChaincodeInput{Args: util.ToChaincodeArgs("f")}}
// if _, err := vm.BuildChaincodeContainer(spec); err != nil {
// t.Error(err)
// }
//}
func TestCar_BuildImage(t *testing.T) {
vm, err := container.NewVM()

if err != nil {
t.Errorf("Error getting VM: %s", err)
return
}
// Build the spec
cwd, err := os.Getwd()
if err != nil {
t.Errorf("Error getting CWD: %s", err)
return
}

chaincodePath := cwd + "/org.hyperledger.chaincode.example02-0.1-SNAPSHOT.car"
spec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_CAR, ChaincodeID: &pb.ChaincodeID{Name: "cartest", Path: chaincodePath}, Input: &pb.ChaincodeInput{Args: util.ToChaincodeArgs("f")}}
if _, err := vm.BuildChaincodeContainer(spec); err != nil {
t.Error(err)
}
}
Binary file not shown.

0 comments on commit b978f0d

Please sign in to comment.