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.

67 lines
2.2 KiB

  1. #! /bin/bash
  2. set -eu
  3. DOCKER_IMAGE=$1
  4. NETWORK_NAME=$2
  5. IPV=$3
  6. N=$4
  7. PROXY_APP=$5
  8. ID=1
  9. echo "----------------------------------------------------------------------"
  10. echo "Testing pex creates the addrbook and uses it if persistent_peers are not provided"
  11. echo "(assuming peers are started with pex enabled)"
  12. CLIENT_NAME="pex_addrbook_$ID"
  13. echo "1. restart peer $ID"
  14. docker stop "local_testnet_$ID"
  15. echo "stopped local_testnet_$ID"
  16. # preserve addrbook.json
  17. docker cp "local_testnet_$ID:/go/src/github.com/tendermint/tendermint/test/p2p/data/mach0/config/addrbook.json" "/tmp/addrbook.json"
  18. set +e #CIRCLE
  19. docker rm -vf "local_testnet_$ID"
  20. set -e
  21. # NOTE that we do not provide persistent_peers
  22. bash test/p2p/peer.sh "$DOCKER_IMAGE" "$NETWORK_NAME" $IPV "$ID" "$PROXY_APP" "--p2p.pex --rpc.unsafe"
  23. echo "started local_testnet_$ID"
  24. # if the client runs forever, it means addrbook wasn't saved or was empty
  25. bash test/p2p/client.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$IPV" "$CLIENT_NAME" "test/p2p/pex/check_peer.sh $IPV $ID $N"
  26. # Now we know that the node is up.
  27. docker cp "/tmp/addrbook.json" "local_testnet_$ID:/go/src/github.com/tendermint/tendermint/test/p2p/data/mach0/config/addrbook.json"
  28. echo "with the following addrbook:"
  29. cat /tmp/addrbook.json
  30. # exec doesn't work on circle
  31. # docker exec "local_testnet_$ID" cat "/go/src/github.com/tendermint/tendermint/test/p2p/data/mach0/config/addrbook.json"
  32. echo ""
  33. echo "----------------------------------------------------------------------"
  34. echo "Testing other peers connect to us if we have neither persistent_peers nor the addrbook"
  35. echo "(assuming peers are started with pex enabled)"
  36. CLIENT_NAME="pex_no_addrbook_$ID"
  37. echo "1. restart peer $ID"
  38. docker stop "local_testnet_$ID"
  39. echo "stopped local_testnet_$ID"
  40. set +e #CIRCLE
  41. docker rm -vf "local_testnet_$ID"
  42. set -e
  43. # NOTE that we do not provide persistent_peers
  44. bash test/p2p/peer.sh "$DOCKER_IMAGE" "$NETWORK_NAME" $IPV "$ID" "$PROXY_APP" "--p2p.pex --rpc.unsafe"
  45. echo "started local_testnet_$ID"
  46. # if the client runs forever, it means other peers have removed us from their books (which should not happen)
  47. bash test/p2p/client.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$IPV" "$CLIENT_NAME" "test/p2p/pex/check_peer.sh $IPV $ID $N"
  48. # Now we know that the node is up.
  49. echo ""
  50. echo "PASS"
  51. echo ""