FAB-5056 enable couchdb test in byfn e2e script

update byfn.sh script to enable couchdb tests. Follow the
below steps from first-network dir

./byfn.sh -m generate -c ibmblockchain
./byfn.sh -m up -c ibmblockchain -s couchdb
./byfn.sh -m down

Change-Id: If84e744b35a96fa1ed314dff0abf845ab363fcbb
Signed-off-by: rameshbabu <rameshbabu.thoomu@gmail.com>
This commit is contained in:
rameshbabu 2017-06-29 14:38:45 +00:00 committed by rameshthoomu
parent 6e096791ef
commit 7f1c2f4225

View file

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
# #
# Copyright IBM Corp All Rights Reserved # Copyright IBM Corp All Rights Reserved
# #
@ -34,7 +35,7 @@ export FABRIC_CFG_PATH=${PWD}
# Print the usage message # Print the usage message
function printHelp () { function printHelp () {
echo "Usage: " echo "Usage: "
echo " byfn.sh -m up|down|restart|generate [-c <channel name>] [-t <timeout>] [-d <delay>] [-f <docker-compose-file>]" echo " byfn.sh -m up|down|restart|generate [-c <channel name>] [-t <timeout>] [-d <delay>] [-f <docker-compose-file>] [-s <dbtype>]"
echo " byfn.sh -h|--help (print this message)" echo " byfn.sh -h|--help (print this message)"
echo " -m <mode> - one of 'up', 'down', 'restart' or 'generate'" echo " -m <mode> - one of 'up', 'down', 'restart' or 'generate'"
echo " - 'up' - bring up the network with docker-compose up" echo " - 'up' - bring up the network with docker-compose up"
@ -45,13 +46,14 @@ function printHelp () {
echo " -t <timeout> - CLI timeout duration in microseconds (defaults to 10000)" echo " -t <timeout> - CLI timeout duration in microseconds (defaults to 10000)"
echo " -d <delay> - delay duration in seconds (defaults to 3)" echo " -d <delay> - delay duration in seconds (defaults to 3)"
echo " -f <docker-compose-file> - specify which docker-compose file use (defaults to docker-compose-cli.yaml)" echo " -f <docker-compose-file> - specify which docker-compose file use (defaults to docker-compose-cli.yaml)"
echo " -s <dbtype> - the database backend to use: goleveldb (default) or couchdb"
echo echo
echo "Typically, one would first generate the required certificates and " echo "Typically, one would first generate the required certificates and "
echo "genesis block, then bring up the network. e.g.:" echo "genesis block, then bring up the network. e.g.:"
echo echo
echo " byfn.sh -m generate -c <channelname>" echo " byfn.sh -m generate -c mychannel"
echo " byfn.sh -m up -c <channelname>" echo " byfn.sh -m up -c mychannel -s couchdb"
echo " byfn.sh -m down -c <channelname>" echo " byfn.sh -m down -c mychannel"
echo echo
echo "Taking all defaults:" echo "Taking all defaults:"
echo " byfn.sh -m generate" echo " byfn.sh -m generate"
@ -109,6 +111,11 @@ function networkUp () {
generateChannelArtifacts generateChannelArtifacts
fi fi
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE up -d 2>&1 CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE up -d 2>&1
if [ "${IF_COUCHDB}" == "couchdb" ]; then
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH up -d 2>&1
else
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT docker-compose -f $COMPOSE_FILE up -d 2>&1
fi
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "ERROR !!!! Unable to start network" echo "ERROR !!!! Unable to start network"
docker logs -f cli docker logs -f cli
@ -120,6 +127,7 @@ function networkUp () {
# Tear down running network # Tear down running network
function networkDown () { function networkDown () {
docker-compose -f $COMPOSE_FILE down docker-compose -f $COMPOSE_FILE down
docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH down
# Don't remove containers, images, etc if restarting # Don't remove containers, images, etc if restarting
if [ "$MODE" != "restart" ]; then if [ "$MODE" != "restart" ]; then
#Cleanup the chaincode containers #Cleanup the chaincode containers
@ -303,9 +311,11 @@ CLI_DELAY=3
CHANNEL_NAME="mychannel" CHANNEL_NAME="mychannel"
# use this as the default docker-compose yaml definition # use this as the default docker-compose yaml definition
COMPOSE_FILE=docker-compose-cli.yaml COMPOSE_FILE=docker-compose-cli.yaml
#
COMPOSE_FILE_COUCH=docker-compose-couch.yaml
# Parse commandline args # Parse commandline args
while getopts "h?m:c:t:d:f:" opt; do while getopts "h?m:c:t:d:f:s:" opt; do
case "$opt" in case "$opt" in
h|\?) h|\?)
printHelp printHelp
@ -321,6 +331,8 @@ while getopts "h?m:c:t:d:f:" opt; do
;; ;;
f) COMPOSE_FILE=$OPTARG f) COMPOSE_FILE=$OPTARG
;; ;;
s) IF_COUCHDB=$OPTARG
;;
esac esac
done done
@ -339,8 +351,13 @@ else
fi fi
# Announce what was requested # Announce what was requested
echo "${EXPMODE} with channel '${CHANNEL_NAME}' and CLI timeout of '${CLI_TIMEOUT}'"
if [ "${IF_COUCHDB}" == "couchdb" ]; then
echo
echo "${EXPMODE} with channel '${CHANNEL_NAME}' and CLI timeout of '${CLI_TIMEOUT}' using database '${IF_COUCHDB}'"
else
echo "${EXPMODE} with channel '${CHANNEL_NAME}' and CLI timeout of '${CLI_TIMEOUT}'"
fi
# ask for confirmation to proceed # ask for confirmation to proceed
askProceed askProceed