Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit a156a23

Browse files
committed
[FAB-4435] gulp test recreates containers
This patch adds a "docker-ready" task to make sure that necessary containers are recreated and up before the "test" task. The "docker-clean" task now calls "docker-compose" to delete containers, and "docker-ready" task depends on the "docker-clean" task, and then calls "docker-compose" to create containers. The "test" task depends on "docker-ready" task so that the containers are recreated and ready before each test run. Change-Id: I4161e54186247d781755aaa2fcec217eeacf695b Signed-off-by: Taku Shimosawa <taku.shimosawa@hal.hitachi.com>
1 parent 4f03644 commit a156a23

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ You can build the docker images in your native host (Mac, Ubuntu, Windows, etc.)
4545
* build fabric peer and orderer docker images and other ancillary images
4646
* `cd $GOPATH/src/github.com/hyperledger/fabric`
4747
* run `make docker` to build the docker images (you may need to run `make docker-clean` first if you've built before)
48-
* go to fabric-sdk-node/test/fixtures
49-
* run `docker-compose up --force-recreate` to launch the network
5048
* Now you are ready to run the tests:
5149
* Clear out your previous key value stores that may have cached user enrollment certificates (`rm -rf /tmp/hfc-*`, `rm -rf ~/.hfc-key-store`)
5250
* run `gulp test` to execute the entire test suite (800+ test cases), or you can run them individually

build/tasks/test.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,21 @@ gulp.task('docker-clean', shell.task([
4141
'docker rm $(docker ps -a | grep "dev-peer0.org[12].example.com-e" | awk \'{print $1}\')',
4242

4343
// remove chaincode images so that they get rebuilt during test
44-
'docker rmi $(docker images | grep "^dev-peer0.org[12].example.com-e" | awk \'{print $3}\')'
44+
'docker rmi $(docker images | grep "^dev-peer0.org[12].example.com-e" | awk \'{print $3}\')',
45+
46+
// clean up all the containers created by docker-compose
47+
'docker-compose -f test/fixtures/docker-compose.yaml down'
4548
], {
4649
verbose: true, // so we can see the docker command output
4750
ignoreErrors: true // kill and rm may fail because the containers may have been cleaned up
4851
}));
4952

50-
gulp.task('test', ['clean-up', 'lint', 'docker-clean', 'pre-test', 'ca'], function() {
53+
gulp.task('docker-ready', ['docker-clean'], shell.task([
54+
// make sure that necessary containers are up by docker-compose
55+
'docker-compose -f test/fixtures/docker-compose.yaml up -d'
56+
]));
57+
58+
gulp.task('test', ['clean-up', 'lint', 'pre-test', 'docker-ready', 'ca'], function() {
5159
// use individual tests to control the sequence they get executed
5260
// first run the ca-tests that tests all the member registration
5361
// and enrollment scenarios (good and bad calls). Then the rest

0 commit comments

Comments
 (0)