docker-compose-files/hyperledger_fabric/latest/scripts/test_cc_peer0.sh

33 lines
909 B
Bash
Raw Normal View History

2017-09-01 20:09:18 +08:00
#!/bin/bash
# Importing useful functions for cc testing
if [ -f ./func.sh ]; then
source ./func.sh
elif [ -f scripts/func.sh ]; then
source scripts/func.sh
fi
2018-03-05 14:10:16 +08:00
CC_NAME=${CC_NAME:-$CC_02_NAME}
CC_INVOKE_ARGS=${CC_INVOKE_ARGS:-$CC_02_INVOKE_ARGS}
CC_QUERY_ARGS=${CC_QUERY_ARGS:-$CC_02_QUERY_ARGS}
2017-12-06 16:24:33 +08:00
echo_b "Channel name: "${APP_CHANNEL}
2017-09-01 20:09:18 +08:00
2017-12-06 16:24:33 +08:00
echo_b "Query the existing value of a"
2019-04-22 14:19:18 +08:00
chaincodeQuery 1 0 "${ORG1_PEER0_URL}" "${ORG1_PEER0_TLS_ROOTCERT}" ${APP_CHANNEL} ${CC_NAME} ${CC_QUERY_ARGS} 100
2017-09-01 20:09:18 +08:00
2017-09-14 15:26:06 +08:00
sleep 1
2017-12-06 16:24:33 +08:00
echo_b "Invoke a transaction to transfer 10 from a to b"
2019-04-22 14:19:18 +08:00
chaincodeInvoke 1 0 "${ORG1_PEER0_URL}" "${ORG1_PEER0_TLS_ROOTCERT}" ${APP_CHANNEL} "${ORDERER_URL}" ${CC_NAME} ${CC_INVOKE_ARGS}
2017-09-01 20:09:18 +08:00
2017-09-14 15:26:06 +08:00
sleep 1
2017-09-01 20:09:18 +08:00
2017-12-06 16:24:33 +08:00
echo_b "Check if the result of a is 90"
2019-04-22 14:19:18 +08:00
chaincodeQuery 1 0 "${ORG1_PEER0_URL}" "${ORG1_PEER0_TLS_ROOTCERT}" ${APP_CHANNEL} ${CC_NAME} ${CC_QUERY_ARGS} 90
2017-09-01 20:09:18 +08:00
echo
2017-12-06 16:24:33 +08:00
echo_g "All GOOD, MVE Test completed"
2017-09-01 20:09:18 +08:00
echo
exit 0