github.com/evdatsion/aphelion-dpos-bft@v0.32.1/test/p2p/pex/test_dial_peers.sh (about)

     1  #! /bin/bash
     2  set -eu
     3  
     4  DOCKER_IMAGE=$1
     5  NETWORK_NAME=$2
     6  N=$3
     7  PROXY_APP=$4
     8  
     9  ID=1
    10  
    11  cd $GOPATH/src/github.com/evdatsion/aphelion-dpos-bft
    12  
    13  echo "----------------------------------------------------------------------"
    14  echo "Testing full network connection using one /dial_peers call"
    15  echo "(assuming peers are started with pex enabled)"
    16  
    17  # stop the existing testnet and remove local network
    18  set +e
    19  bash test/p2p/local_testnet_stop.sh $NETWORK_NAME $N
    20  set -e
    21  
    22  # start the testnet on a local network
    23  # NOTE we re-use the same network for all tests
    24  bash test/p2p/local_testnet_start.sh $DOCKER_IMAGE $NETWORK_NAME $N $PROXY_APP ""
    25  
    26  PERSISTENT_PEERS="\"$(test/p2p/ip_plus_id.sh 1 $DOCKER_IMAGE):26656\""
    27  for i in $(seq 2 $N); do
    28  	PERSISTENT_PEERS="$PERSISTENT_PEERS,\"$(test/p2p/ip_plus_id.sh $i $DOCKER_IMAGE):26656\""
    29  done
    30  echo "$PERSISTENT_PEERS"
    31  
    32  # dial peers from one node
    33  CLIENT_NAME="dial_peers"
    34  bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME $CLIENT_NAME "test/p2p/pex/dial_peers.sh $N $PERSISTENT_PEERS"
    35  
    36  # test basic connectivity and consensus
    37  # start client container and check the num peers and height for all nodes
    38  CLIENT_NAME="dial_peers_basic"
    39  bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME $CLIENT_NAME "test/p2p/basic/test.sh $N"