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.

57 lines
2.0 KiB

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