Skip to content

Commit

Permalink
[FAB-2485] clean up docker-compose within unit tests
Browse files Browse the repository at this point in the history
https://jira.hyperledger.org/browse/FAB-2485

This patch adds cleanup for docker-compose unit tests to the
Makefile.

The following changes were made:

Makefile: add unit-test-clean target that runs
docker-compose down

Ensures unit-test-clean is called prior to running unit tests and
for the clean target.

Change-Id: I7d667993a1c4709cf5313fcafb317d81298e1271
Signed-off-by: Troy Ronda <troy@troyronda.com>
  • Loading branch information
troyronda committed Mar 27, 2017
1 parent 397f5de commit a594b6d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# - unit-test - runs the go-test based unit tests
# - test-cmd - generates a "go test" string suitable for manual customization
# - behave - runs the behave test
# - behave-deps - ensures pre-requisites are availble for running behave manually
# - behave-deps - ensures pre-requisites are available for running behave manually
# - gotools - installs go tools like golint
# - linter - runs all code checks
# - native - ensures all native binaries are available
Expand All @@ -33,6 +33,7 @@
# - protos - generate all protobuf artifacts based on .proto files
# - clean - cleans the build area
# - dist-clean - superset of 'clean' that also removes persistent state
# - unit-test-clean - cleans unit test state (particularly from docker)

PROJECT_NAME = hyperledger/fabric
BASE_VERSION = 1.0.0
Expand Down Expand Up @@ -114,7 +115,7 @@ testenv: build/image/testenv/$(DUMMY)

couchdb: build/image/couchdb/$(DUMMY)

unit-test: peer-docker testenv couchdb
unit-test: unit-test-clean peer-docker testenv couchdb
cd unit-test && docker-compose up --abort-on-container-exit --force-recreate && docker-compose down

unit-tests: unit-test
Expand Down Expand Up @@ -267,9 +268,13 @@ protos: buildenv
docker-clean: $(patsubst %,%-docker-clean, $(IMAGES))

.PHONY: clean
clean: docker-clean
clean: docker-clean unit-test-clean
-@rm -rf build ||:

.PHONY: dist-clean
dist-clean: clean gotools-clean
-@rm -rf /var/hyperledger/* ||:

.PHONY: unit-test-clean
unit-test-clean:
cd unit-test && docker-compose down

0 comments on commit a594b6d

Please sign in to comment.