From b43fa16647867cce75b16c290dd3c7d614abbb23 Mon Sep 17 00:00:00 2001 From: Rastislav Szabo Date: Fri, 6 Oct 2017 23:10:46 +0200 Subject: [PATCH] enable CNI unit tests --- Makefile | 8 +++++--- cmd/contiv-cni/contiv_cni_test.go | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d0cff8d150..6f6bdecf64 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,7 @@ endef # run all tests define test_only @echo "# running unit tests" + @go test ./cmd/contiv-cni @go test ./plugins/contiv @go test ./plugins/kvdbproxy @echo "# done" @@ -37,11 +38,12 @@ endef # run all tests with coverage define test_cover_only @echo "# running unit tests with coverage analysis" - @go test -covermode=count -coverprofile=${COVER_DIR}coverage_unit1.out ./plugins/contiv - @go test -covermode=count -coverprofile=${COVER_DIR}coverage_unit2.out ./plugins/kvdbproxy + @go test -covermode=count -coverprofile=${COVER_DIR}cov_u1.out ./cmd/contiv-cni + @go test -covermode=count -coverprofile=${COVER_DIR}cov_u2.out ./plugins/contiv + @go test -covermode=count -coverprofile=${COVER_DIR}cov_u3.out ./plugins/kvdbproxy @echo "# merging coverage results" @cd vendor/github.com/wadey/gocovmerge && go install -v - @gocovmerge ${COVER_DIR}coverage_unit1.out ${COVER_DIR}coverage_unit2.out > ${COVER_DIR}coverage.out + @gocovmerge ${COVER_DIR}cov_u1.out ${COVER_DIR}cov_u2.out ${COVER_DIR}cov_u3.out > ${COVER_DIR}coverage.out @echo "# coverage data generated into ${COVER_DIR}coverage.out" @echo "# done" endef diff --git a/cmd/contiv-cni/contiv_cni_test.go b/cmd/contiv-cni/contiv_cni_test.go index 15d7e638bc..cd494f2096 100644 --- a/cmd/contiv-cni/contiv_cni_test.go +++ b/cmd/contiv-cni/contiv_cni_test.go @@ -114,8 +114,7 @@ func TestCNIAddDelete(t *testing.T) { RegisterTestingT(t) // start testing gRPC server - grpcServer := runTestGrpcServer() - defer grpcServer.Stop() + runTestGrpcServer() // prepare CNI config conf := `{