2
0

test_cc_invoke_query.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132
  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. #Query on chaincode on Peer0/Org1
  9. echo_b "Querying chaincode on peer org2/peer0..."
  10. chaincodeQuery ${APP_CHANNEL} 2 1 ${CC_NAME} ${CC_QUERY_ARGS} 100
  11. #Invoke on chaincode on Peer0/Org1
  12. echo_b "Sending invoke transaction (transfer 10) on org1/peer0..."
  13. chaincodeInvoke ${APP_CHANNEL} 1 0 ${CC_NAME} ${CC_INVOKE_ARGS}
  14. #Query on chaincode on Peer1/Org2, check if the result is 90
  15. echo_b "Querying chaincode on peer 1 and 3..."
  16. chaincodeQuery ${APP_CHANNEL} 1 1 ${CC_NAME} ${CC_QUERY_ARGS} 90
  17. chaincodeQuery ${APP_CHANNEL} 2 1 ${CC_NAME} ${CC_QUERY_ARGS} 90
  18. #Invoke on chaincode on Peer1/Org2
  19. echo_b "Sending invoke transaction on org2/peer3..."
  20. chaincodeInvoke ${APP_CHANNEL} 2 1 ${CC_NAME} ${CC_INVOKE_ARGS}
  21. #Query on chaincode on Peer1/Org2, check if the result is 80
  22. echo_b "Querying chaincode on all 4peers..."
  23. chaincodeQuery ${APP_CHANNEL} 1 0 ${CC_NAME} ${CC_QUERY_ARGS} 80
  24. chaincodeQuery ${APP_CHANNEL} 2 0 ${CC_NAME} ${CC_QUERY_ARGS} 80
  25. echo_g "=== All GOOD, chaincode invoke/query completed ==="