Skip to content

Commit

Permalink
[FAB-3027] Added Makefile
Browse files Browse the repository at this point in the history
Added targets for running unit and integration tests

Change-Id: I171709bc90e76d2f6f26aa9453c13ebcc4afedce
Signed-off-by: Divyank Katira <[email protected]>
  • Loading branch information
d1vyank committed Apr 6, 2017
1 parent ca82dda commit 818aac3
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
39 changes: 39 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Copyright SecureKey Technologies Inc. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# 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:
# unit-test: runs all the unit tests
# integration-test: runs all the integration tests

unit-test:
sh scripts/unit.sh

unit-tests: unit-test

integration-test:
sh scripts/integration.sh

integration-tests: integration-test

clean:
cd test/fixtures && docker-compose down && docker ps -q -a | xargs docker rm -f
15 changes: 15 additions & 0 deletions scripts/integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Packages to exclude
PKGS=`go list github.com/hyperledger/fabric-sdk-go/test/... 2> /dev/null | \
grep -v /vendor/`

echo "Starting fabric and fabric-ca docker images..."
cd ./test/fixtures && docker-compose up --force-recreate -d

sleep 1

echo "Running tests..."
gocov test -ldflags "$GO_LDFLAGS" $PKGS -p 1 -timeout=10m | gocov-xml > report.xml

docker-compose down
10 changes: 10 additions & 0 deletions scripts/unit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

# Packages to exclude
PKGS=`go list github.com/hyperledger/fabric-sdk-go/... 2> /dev/null | \
grep -v /vendor/ | \
grep -v /test/`
echo "Running tests..."
gocov test -ldflags "$GO_LDFLAGS" $PKGS -p 1 -timeout=5m | gocov-xml > report.xml

0 comments on commit 818aac3

Please sign in to comment.