You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
810 B

  1. #! /bin/bash
  2. set -e
  3. function toHex() {
  4. echo -n $1 | hexdump -ve '1/1 "%.2X"'
  5. }
  6. #####################
  7. # dummy with curl
  8. #####################
  9. TESTNAME=$1
  10. # store key value pair
  11. KEY="abcd"
  12. VALUE="dcba"
  13. curl 127.0.0.1:46657/broadcast_tx_commit?tx=\"$(toHex $KEY=$VALUE)\"
  14. echo $?
  15. echo ""
  16. # we should be able to look up the key
  17. RESPONSE=`tmsp-cli query $KEY`
  18. set +e
  19. A=`echo $RESPONSE | grep exists=true`
  20. if [[ $? != 0 ]]; then
  21. echo "Failed to find 'exists=true' for $KEY. Response:"
  22. echo "$RESPONSE"
  23. exit 1
  24. fi
  25. set -e
  26. # we should not be able to look up the value
  27. RESPONSE=`tmsp-cli query $VALUE`
  28. set +e
  29. A=`echo $RESPONSE | grep exists=true`
  30. if [[ $? == 0 ]]; then
  31. echo "Found 'exists=true' for $VALUE when we should not have. Response:"
  32. echo "$RESPONSE"
  33. exit 1
  34. fi
  35. set -e
  36. echo "Passed Test: $TESTNAME"