From 10712fea8a29edb6c1e0aae266beaaa1cf0919ec Mon Sep 17 00:00:00 2001 From: Divyank Katira Date: Fri, 7 Apr 2017 12:15:57 -0400 Subject: [PATCH] [FAB-3027] Updated CI scripts Change-Id: I528cb18b860938ff17900e9e636636e528dcee59 Signed-off-by: Divyank Katira --- Makefile | 18 ++++++++++++------ README.md | 2 +- test/scripts/fabric_test_commitlevel.sh | 5 +++++ {scripts => test/scripts}/integration.sh | 10 +++++----- {scripts => test/scripts}/unit.sh | 0 5 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 test/scripts/fabric_test_commitlevel.sh rename {scripts => test/scripts}/integration.sh (71%) rename {scripts => test/scripts}/unit.sh (100%) diff --git a/Makefile b/Makefile index 4ce83c4156..21a9d7a263 100644 --- a/Makefile +++ b/Makefile @@ -17,26 +17,32 @@ # limitations under the License. # - +# # This MakeFile assumes that fabric, and fabric-ca were cloned and their docker # images were created using the make docker command in the respective directories # # Supported Targets: # all : runs unit and integration tests +# depend: installs test dependencies # unit-test: runs all the unit tests # integration-test: runs all the integration tests +# clean: stops docker conatainers used for integration testing +# all: unit-test integration-test -unit-test: - sh scripts/unit.sh +depend: + go get github.com/axw/gocov/... && go get github.com/AlekSi/gocov-xml + +unit-test: depend + sh test/scripts/unit.sh unit-tests: unit-test -integration-test: - sh scripts/integration.sh +integration-test: clean depend + sh test/scripts/integration.sh integration-tests: integration-test clean: - cd test/fixtures && docker-compose down && docker ps -q -a | xargs docker rm -f + cd test/fixtures && docker-compose down diff --git a/README.md b/README.md index 6fdd2a0688..4e10d2d251 100644 --- a/README.md +++ b/README.md @@ -26,4 +26,4 @@ Execute `go test` in the `test/integration` to run end-to-end tests. This requir This client was last tested and found to be compatible with the following Hyperledger Fabric commit levels: - fabric: v1.0.0-alpha -- fabric-ca: `4651512e4e85728e6ecaf21b8cba52f51ed16633` +- fabric-ca: v1.0.0-alpha diff --git a/test/scripts/fabric_test_commitlevel.sh b/test/scripts/fabric_test_commitlevel.sh new file mode 100644 index 0000000000..a4a983e8ae --- /dev/null +++ b/test/scripts/fabric_test_commitlevel.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +#file used for automatic integration build test +#This should always match what's in the README.md +export FABRIC_COMMIT=fa3d88cde177750804c7175ae000e0923199735c +export FABRIC_CA_COMMIT=b587a4809438cc91787c49c11198dea70e2647b4 diff --git a/scripts/integration.sh b/test/scripts/integration.sh similarity index 71% rename from scripts/integration.sh rename to test/scripts/integration.sh index 8eb9b57fa7..2deccb6d05 100644 --- a/scripts/integration.sh +++ b/test/scripts/integration.sh @@ -7,9 +7,9 @@ PKGS=`go list github.com/hyperledger/fabric-sdk-go/test/... 2> /dev/null | \ echo "Starting fabric and fabric-ca docker images..." cd ./test/fixtures && docker-compose up --force-recreate -d -sleep 1 +echo "Running integration tests..." +cd ../../ +gocov test -ldflags "$GO_LDFLAGS" $PKGS -p 1 -timeout=10m | gocov-xml > integration-report.xml -echo "Running tests..." -gocov test -ldflags "$GO_LDFLAGS" $PKGS -p 1 -timeout=10m | gocov-xml > report.xml - -docker-compose down +echo "Cleaning up..." +cd ./test/fixtures && docker-compose down diff --git a/scripts/unit.sh b/test/scripts/unit.sh similarity index 100% rename from scripts/unit.sh rename to test/scripts/unit.sh