Fix while checking
parent
7ad4f7d6e1
commit
8585c03dc7
|
@ -40,6 +40,8 @@ ready: # create/join channel, install/instantiate cc
|
|||
make test_qscc # test qscc operations
|
||||
make test_fetch_blocks # fetch block files
|
||||
|
||||
make logs_save
|
||||
|
||||
make test_configtxlator
|
||||
|
||||
@echo "Now the fabric network is ready to play"
|
||||
|
@ -146,7 +148,7 @@ logs: # show logs
|
|||
logs_check: logs_save logs_view
|
||||
|
||||
logs_save: # save logs
|
||||
docker logs peer0.org1.example.com >& /tmp/dev_peer.log
|
||||
docker logs peer0.org1.example.com >& /tmp/dev_peer0.log
|
||||
docker logs orderer.example.com >& /tmp/dev_orderer.log
|
||||
docker-compose -f ${COMPOSE_FILE} logs >& /tmp/dev_all.log
|
||||
|
||||
|
@ -170,9 +172,16 @@ test_configtxlator: # Test change config using configtxlator
|
|||
download: # download required images
|
||||
@echo "Download Docker images"
|
||||
docker pull yeasy/hyperledger-fabric:latest
|
||||
docker pull yeasy/hyperledger-fabric-kafka:0.10.2.0 # official repo does not provide the latest image currently
|
||||
docker pull yeasy/hyperledger-fabric-peer:latest
|
||||
docker pull yeasy/hyperledger-fabric-orderer:latest
|
||||
docker pull yeasy/hyperledger-fabric-ca:latest
|
||||
docker pull yeasy/hyperledger-fabric-kafka:0.10.2.0 # TODO:official repo does not provide the latest image currently
|
||||
docker pull hyperledger/fabric-baseos:x86_64-0.4.2
|
||||
docker tag yeasy/hyperledger-fabric:latest hyperledger/fabric-ccenv:x86_64-1.1.0
|
||||
docker pull hyperledger/fabric-zookeeper:x86_64-1.0.4
|
||||
docker pull hyperledger/fabric-kafka:x86_64-1.0.4
|
||||
docker pull hyperledger/fabric-couchdb:x86_64-1.0.4
|
||||
docker pull hyperledger/fabric-ccenv:x86_64-1.0.4
|
||||
#docker tag yeasy/hyperledger-fabric-peer:latest hyperledger/fabric-ccenv:x86_64-1.0.4
|
||||
|
||||
################## chaincode dev mode ################
|
||||
chaincode_init: # start chaincode in dev mode and do install/instantiate
|
||||
|
|
|
@ -300,37 +300,34 @@ chaincodeQuery () {
|
|||
local name=$4
|
||||
local args=$5
|
||||
[ $# -gt 5 ] && local expected_result=$6
|
||||
echo_b "=== Querying on peer$peer in channel ${channel}... === "
|
||||
echo_b "=== Querying on org$org peer$peer in channel ${channel}... === "
|
||||
local rc=1
|
||||
local starttime=$(date +%s)
|
||||
|
||||
setEnvs $org $peer
|
||||
# we either get a successful response, or reach TIMEOUT
|
||||
while test "$(($(date +%s)-starttime))" -lt "$TIMEOUT" -a $rc -ne 0
|
||||
do
|
||||
while [ "$(($(date +%s)-starttime))" -lt "$TIMEOUT" -a $rc -ne 0 ]; do
|
||||
echo_b "Attempting to Query peer$peer ...$(($(date +%s)-starttime)) secs"
|
||||
peer chaincode query \
|
||||
-C "${channel}" \
|
||||
-n "${name}" \
|
||||
-c "${args}" \
|
||||
>&log.txt
|
||||
rc=$?
|
||||
if [ $# -gt 5 ]; then # need to check the result
|
||||
test $? -eq 0 && VALUE=$(cat log.txt | awk '/Query Result/ {print $NF}')
|
||||
test "$VALUE" = "${expected_result}" && let rc=0
|
||||
sleep 3
|
||||
else
|
||||
rc=0
|
||||
fi
|
||||
cat log.txt
|
||||
if [ $rc -ne 0 ]; then
|
||||
sleep 2
|
||||
fi
|
||||
done
|
||||
echo
|
||||
cat log.txt
|
||||
if test $rc -eq 0 ; then
|
||||
echo_g "=== Query on peer$peer in channel ${channel} is successful === "
|
||||
if [ $rc -eq 0 ]; then
|
||||
echo_g "=== Query on peer$peer in channel ${channel} is successful === "
|
||||
else
|
||||
echo_r "!!!!!!!!!!!!!!! Query result on peer$peer is INVALID !!!!!!!!!!!!!!!!"
|
||||
echo_r "================== ERROR !!! FAILED to execute End-2-End Scenario =================="
|
||||
echo
|
||||
exit 1
|
||||
echo_r "=== Query result on peer$peer is INVALID, run `make stop clean` to clean ==="
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ docker run \
|
|||
sleep 1
|
||||
|
||||
echo_b "Convert all config block files into json"
|
||||
for BLOCK_FILE in *_0.block; do
|
||||
for BLOCK_FILE in *_0.block *.genesis.block; do
|
||||
if [ -f ${BLOCK_FILE} ]; then
|
||||
configtxlatorDecode "common.Block" ${BLOCK_FILE} ${BLOCK_FILE}.json
|
||||
echo_b "Parse payload..."
|
||||
|
|
|
@ -15,10 +15,10 @@ org=1
|
|||
peer=0
|
||||
|
||||
echo_b "QSCC GetChainInfo"
|
||||
chaincodeQuery "" $org $peer qscc '{"Args":["GetChainInfo","'${APP_CHANNEL}'"]}'
|
||||
chaincodeQuery ${APP_CHANNEL} $org $peer qscc '{"Args":["GetChainInfo","'${APP_CHANNEL}'"]}'
|
||||
|
||||
echo_b "QSCC GetBlockByNumber 2"
|
||||
chaincodeQuery "" $org $peer qscc '{"Args":["GetBlockByNumber","'${APP_CHANNEL}'","2"]}'
|
||||
chaincodeQuery ${APP_CHANNEL} $org $peer qscc '{"Args":["GetBlockByNumber","'${APP_CHANNEL}'","2"]}'
|
||||
|
||||
#peer chaincode query \
|
||||
# -C "" \
|
||||
|
|
|
@ -7,7 +7,7 @@ SYS_CHANNEL="testchainid"
|
|||
APP_CHANNEL="businesschannel"
|
||||
|
||||
# Client cmd execute timeout and retry times
|
||||
TIMEOUT="60"
|
||||
TIMEOUT="30"
|
||||
MAX_RETRY=5
|
||||
|
||||
# Organization and peers
|
||||
|
|
|
@ -29,17 +29,22 @@ all:
|
|||
ready: # create/join channel, install/instantiate cc
|
||||
make gen_config # Will ignore if local config path exists
|
||||
make restart
|
||||
|
||||
make test_channel_create
|
||||
make test_channel_join
|
||||
# make update_anchors
|
||||
|
||||
make test_cc_install
|
||||
make test_cc_instantiate
|
||||
|
||||
make test_cc_invoke_query
|
||||
|
||||
make test_lscc # test lscc operations
|
||||
make test_qscc # test qscc operations
|
||||
#make test_qscc # TODO: test qscc operations
|
||||
|
||||
make test_fetch_blocks # fetch block files
|
||||
|
||||
make logs_save
|
||||
|
||||
make test_configtxlator
|
||||
|
||||
@echo "Now the fabric network is ready to play"
|
||||
|
@ -146,7 +151,7 @@ logs: # show logs
|
|||
logs_check: logs_save logs_view
|
||||
|
||||
logs_save: # save logs
|
||||
docker logs peer0.org1.example.com >& /tmp/dev_peer.log
|
||||
docker logs peer0.org1.example.com >& /tmp/dev_peer0.log
|
||||
docker logs orderer.example.com >& /tmp/dev_orderer.log
|
||||
docker-compose -f ${COMPOSE_FILE} logs >& /tmp/dev_all.log
|
||||
|
||||
|
|
|
@ -306,31 +306,28 @@ chaincodeQuery () {
|
|||
|
||||
setEnvs $org $peer
|
||||
# we either get a successful response, or reach TIMEOUT
|
||||
while test "$(($(date +%s)-starttime))" -lt "$TIMEOUT" -a $rc -ne 0
|
||||
do
|
||||
while [ "$(($(date +%s)-starttime))" -lt "$TIMEOUT" -a $rc -ne 0 ]; do
|
||||
echo_b "Attempting to Query peer$peer ...$(($(date +%s)-starttime)) secs"
|
||||
peer chaincode query \
|
||||
-C "${channel}" \
|
||||
-n "${name}" \
|
||||
-c "${args}" \
|
||||
>&log.txt
|
||||
rc=$?
|
||||
if [ $# -gt 5 ]; then # need to check the result
|
||||
test $? -eq 0 && VALUE=$(cat log.txt | awk '/Query Result/ {print $NF}')
|
||||
test "$VALUE" = "${expected_result}" && let rc=0
|
||||
else
|
||||
rc=$?
|
||||
fi
|
||||
sleep 2
|
||||
cat log.txt
|
||||
if [ $rc -ne 0 ]; then
|
||||
sleep 2
|
||||
fi
|
||||
done
|
||||
echo
|
||||
cat log.txt
|
||||
if test $rc -eq 0 ; then
|
||||
if [ $rc -eq 0 ]; then
|
||||
echo_g "=== Query on peer$peer in channel ${channel} is successful === "
|
||||
else
|
||||
echo_r "Query result on peer$peer is INVALID"
|
||||
echo_r "=== ERROR !!! FAILED to execute End-2-End Scenario ==="
|
||||
echo
|
||||
exit 1
|
||||
echo_r "=== Query result on peer$peer is INVALID, run `make stop clean` to clean ==="
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue