2016-07-01 2 views
0

나는 hyperledger/패브릭 프로젝트를 포크하고 내의 repo에서 나는 다음과 같은 명령을 사용하여 ECA에 대한 단위 테스트를 실행하려고 : 나는 다음과 같은 오류를 얻을 그러나 :membersrvc 내 단위 테스트를 golang 실행할 수 없음/캘리포니아

나는 최근에 내 포크를 업데이트

[email protected]: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]

몇 일 다시 나를 위해에서 일하기 위하여 사용이 하지만 이후 : 나는 CA 단위 테스트를 실행하려고하면

[email protected]: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]

마찬가지로 나는 다음과 같은 오류가 발생합니다 하이퍼 링크에서 바뀐다. R/프로젝트는 내가 테스트 여기

를 실행할 수 아니에요의 내 GOPATH의 값 : 나는 왜 golang 빌드 시스템 경로에 "- 명령/공급 업체"를 추가한다 모르겠어요

[email protected]:v0.0.10-37b6688:/opt/gopath/src/github.com/hyperledger/fabric$ echo $GOPATH /opt/gopath

때를 가져온 패키지를 찾고 있습니다. 아무도 나를 도와 줄 수 없습니까?

답변

1

설명서에 따르면 go test은 패키지 이름이 매개 변수로 필요합니다. go test .을 실행하고이 패키지에 대한 모든 테스트를 실행하면 테스트에 문제가 없어야합니다.

go test eca_test.go을 실행할 수 있지만이 경우 'eca_test'를 빌드하는 데 필요한 다른 모든 파일을 지정해야합니다. 자세한 내용은 "How to run test cases in a specified file?"을 참조하십시오.

실행하려는 경우이 패키지에서 하나의 테스트 만 사용하는 것이 더 좋습니다 go test . -run TestNewECA "TestNewECA"는 파일 이름이 아닌 eca_test.go의 테스트 함수 이름입니다.

+0

감사합니다. Sergey, 맞아요. 추가하기 만하면 다른 사용자의 이익을 위해 하이퍼 리더에서 모든 단위 테스트를 실행하는 공식적인 방법은 "단위 테스트 만들기"명령을 실행하여 최상위 디렉토리/하이퍼 리더/패브릭에서 수행합니다 –

관련 문제