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

33 lines
1.2 KiB
Bash
Raw Normal View History

2017-12-06 22:30:57 +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_PATH=${CC_PATH:-$CC_02_PATH}
CC_UPGRADE_ARGS=${CC_UPGRADE_ARGS:-$CC_02_UPGRADE_ARGS}
CC_QUERY_ARGS=${CC_QUERY_ARGS:-$CC_02_QUERY_ARGS}
2017-12-06 22:30:57 +08:00
#Upgrade to new version
2018-01-30 15:54:49 +08:00
echo_b "=== Upgrade chaincode ${CC_NAME} to new version... ==="
2018-01-05 14:37:52 +08:00
chaincodeInstall 1 0 "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_PATH}"
chaincodeInstall 1 1 "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_PATH}"
chaincodeInstall 2 0 "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_PATH}"
chaincodeInstall 2 1 "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_PATH}"
2017-12-06 22:30:57 +08:00
# Upgrade on one peer of the channel will update all
2019-05-02 17:30:13 +08:00
chaincodeUpgrade ${APP_CHANNEL} 1 0 ${ORDERER0_URL} "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_UPGRADE_ARGS}"
2017-12-06 22:30:57 +08:00
# Query new value, should refresh through all peers in the channel
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
chaincodeQuery 2 1 "${ORG1_PEER0_URL}" "${ORG1_PEER0_TLS_ROOTCERT}" ${APP_CHANNEL} "${CC_NAME}" "${CC_QUERY_ARGS}" 100
2017-12-06 22:30:57 +08:00
2018-01-30 15:54:49 +08:00
echo_g "=== chaincode ${CC_NAME} Upgrade completed ==="
echo