Skip to content

Commit

Permalink
FAB-5056 enable couchdb test in byfn e2e script
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rameshthoomu committed Aug 8, 2017
1 parent 6e09679 commit 7f1c2f4
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions first-network/byfn.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
#

#
# Copyright IBM Corp All Rights Reserved
#
# SPDX-License-Identifier: Apache-2.0
Expand Down Expand Up @@ -34,7 +35,7 @@ export FABRIC_CFG_PATH=${PWD}
# Print the usage message
function printHelp () {
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 " -m <mode> - one of 'up', 'down', 'restart' or 'generate'"
echo " - 'up' - bring up the network with docker-compose up"
Expand All @@ -45,13 +46,14 @@ function printHelp () {
echo " -t <timeout> - CLI timeout duration in microseconds (defaults to 10000)"
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 " -s <dbtype> - the database backend to use: goleveldb (default) or couchdb"
echo
echo "Typically, one would first generate the required certificates and "
echo "genesis block, then bring up the network. e.g.:"
echo
echo " byfn.sh -m generate -c <channelname>"
echo " byfn.sh -m up -c <channelname>"
echo " byfn.sh -m down -c <channelname>"
echo " byfn.sh -m generate -c mychannel"
echo " byfn.sh -m up -c mychannel -s couchdb"
echo " byfn.sh -m down -c mychannel"
echo
echo "Taking all defaults:"
echo " byfn.sh -m generate"
Expand Down Expand Up @@ -109,6 +111,11 @@ function networkUp () {
generateChannelArtifacts
fi
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
echo "ERROR !!!! Unable to start network"
docker logs -f cli
Expand All @@ -120,6 +127,7 @@ function networkUp () {
# Tear down running network
function networkDown () {
docker-compose -f $COMPOSE_FILE down
docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH down
# Don't remove containers, images, etc if restarting
if [ "$MODE" != "restart" ]; then
#Cleanup the chaincode containers
Expand Down Expand Up @@ -303,9 +311,11 @@ CLI_DELAY=3
CHANNEL_NAME="mychannel"
# use this as the default docker-compose yaml definition
COMPOSE_FILE=docker-compose-cli.yaml
#
COMPOSE_FILE_COUCH=docker-compose-couch.yaml

# 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
h|\?)
printHelp
Expand All @@ -321,6 +331,8 @@ while getopts "h?m:c:t:d:f:" opt; do
;;
f) COMPOSE_FILE=$OPTARG
;;
s) IF_COUCHDB=$OPTARG
;;
esac
done

Expand All @@ -339,8 +351,13 @@ else
fi

# 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
askProceed

Expand All @@ -349,7 +366,7 @@ if [ "${MODE}" == "up" ]; then
networkUp
elif [ "${MODE}" == "down" ]; then ## Clear the network
networkDown
elif [ "${MODE}" == "generate" ]; then ## Generate Artifacts
elif [ "${MODE}" == "generate" ]; then ## Generate Artifacts
generateCerts
replacePrivateKey
generateChannelArtifacts
Expand Down

0 comments on commit 7f1c2f4

Please sign in to comment.