0

I have forked the hyperledger/fabric project and in my repo I tried to run the unit tests for ECA using the following command: However I get the following error:

vagrant@hyperledger-devenv:v0.0.10-37b6688:/opt/gopath/src/github.com/hyperledger/fabric/membersrvc/ca$ go test eca_test.go
command-line-arguments
eca_test.go:30:2: cannot find package "command-/vendor/github.com/golang/protobuf/proto" in any of:
/opt/go/src/command-/vendor/github.com/golang/protobuf/proto (from $GOROOT)
/opt/gopath/src/command-/vendor/github.com/golang/protobuf/proto (from $GOPATH)
FAIL command-line-arguments [setup failed]

Similarly I get the following error when I try to run the CA unit tests:

vagrant@hyperledger-devenv:v0.0.10-37b6688:/opt/gopath/src/github.com/hyperledger/fabric/membersrvc/ca$ go test ca_test.go
command-line-arguments
ca_test.go:28:2: cannot find package "command-/vendor/github.com/spf13/viper" in any of: /opt/go/src/command-/vendor/github.com/spf13/viper (from $GOROOT)
/opt/gopath/src/command-/vendor/github.com/spf13/viper (from >$GOPATH)
FAIL command-line-arguments [setup failed]

These USED TO WORK for me a few days back, but after I updated my fork with the latest changes from hyperledger/project I'm not able to run the test

Here's my GOPATH's value:

vagrant@hyperledger-devenv:v0.0.10-37b6688:/opt/gopath/src/github.com/hyperledger/fabric$ echo $GOPATH /opt/gopath

I'm not sure why golang build system is appending "command-/vendor" to the path when it is looking for imported packages. Could anybody help me out with this?

1 Answer 1

1

According to the documentation go test expects package name as a parameter. The should be no issues with tests if you run go test . and execute all tests for this package.

It possible to run go test eca_test.go but in this case you have to specify all other files required to build ‘eca_test’. See "How to run test cases in a specified file?" for more details.

If you would like to run just one test from this package is better to use go test . -run TestNewECA “TestNewECA” is the name of test function in eca_test.go, not the file name.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Sergey, that seems correct. Just to add, for the benefit of other users..the official way of running all the unit tests in hyperledger is from the top level directory /hyperledger/fabric by issuing "make unit-test" command

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.