test_cc_upgrade.sh 928 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. # Importing useful functions for cc testing
  3. if [ -f ./func.sh ]; then
  4. source ./func.sh
  5. elif [ -f scripts/func.sh ]; then
  6. source scripts/func.sh
  7. fi
  8. #Upgrade to new version
  9. echo_b "Upgrade chaincode to new version..."
  10. chaincodeInstall 1 0 "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_PATH}"
  11. chaincodeInstall 1 1 "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_PATH}"
  12. chaincodeInstall 2 0 "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_PATH}"
  13. chaincodeInstall 2 1 "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_PATH}"
  14. # Upgrade on one peer of the channel will update all
  15. chaincodeUpgrade ${APP_CHANNEL} 1 0 "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_UPGRADE_ARGS}"
  16. # Query new value, should refresh through all peers in the channel
  17. chaincodeQuery ${APP_CHANNEL} 1 0 "${CC_NAME}" "${CC_QUERY_ARGS}" 100
  18. chaincodeQuery ${APP_CHANNEL} 2 1 "${CC_NAME}" "${CC_QUERY_ARGS}" 100
  19. echo_g "=== All GOOD, chaincode Upgrade completed ==="