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.

34 lines
750 B

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