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

25 lines
928 B
Bash

#!/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
chaincodeUpgrade ${APP_CHANNEL} 1 0 "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_UPGRADE_ARGS}"
# Query new value, should refresh through all peers in the channel
chaincodeQuery ${APP_CHANNEL} 1 0 "${CC_NAME}" "${CC_QUERY_ARGS}" 100
chaincodeQuery ${APP_CHANNEL} 2 1 "${CC_NAME}" "${CC_QUERY_ARGS}" 100
echo_g "=== All GOOD, chaincode Upgrade completed ==="