docker-compose-files/hyperledger_fabric/v1.0.4/scripts/test_cc_upgrade.sh

25 lines
890 B
Bash
Raw Normal View History

2017-11-24 14:45:16 +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
#Upgrade to new version
echo_b "Upgrade chaincode to new version..."
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}
# Upgrade on one peer of the channel will update all
2017-12-06 16:24:33 +08:00
chaincodeUpgrade ${APP_CHANNEL} 1 0 ${CC_NAME} ${CC_UPGRADE_VERSION} ${CC_UPGRADE_ARGS}
2017-11-24 14:45:16 +08:00
# Query new value, should refresh through all peers in the channel
2017-12-06 16:24:33 +08:00
chaincodeQuery ${APP_CHANNEL} 1 0 ${CC_NAME} ${CC_QUERY_ARGS} 100
chaincodeQuery ${APP_CHANNEL} 2 1 ${CC_NAME} ${CC_QUERY_ARGS} 100
2017-11-24 14:45:16 +08:00
echo_g "=== All GOOD, chaincode Upgrade completed ==="