mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-22 01:25:10 +00:00
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:
parent
6e096791ef
commit
7f1c2f4225
1 changed files with 25 additions and 8 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
|
||||||
|
#
|
||||||
# Copyright IBM Corp All Rights Reserved
|
# Copyright IBM Corp All Rights Reserved
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
@ -349,7 +366,7 @@ if [ "${MODE}" == "up" ]; then
|
||||||
networkUp
|
networkUp
|
||||||
elif [ "${MODE}" == "down" ]; then ## Clear the network
|
elif [ "${MODE}" == "down" ]; then ## Clear the network
|
||||||
networkDown
|
networkDown
|
||||||
elif [ "${MODE}" == "generate" ]; then ## Generate Artifacts
|
elif [ "${MODE}" == "generate" ]; then ## Generate Artifacts
|
||||||
generateCerts
|
generateCerts
|
||||||
replacePrivateKey
|
replacePrivateKey
|
||||||
generateChannelArtifacts
|
generateChannelArtifacts
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue