github.com/pokt-network/tendermint@v0.32.11-0.20230426215212-59310158d3e9/test/app/test.sh (about)

     1  #! /bin/bash
     2  set -ex
     3  
     4  #- kvstore over socket, curl
     5  #- counter over socket, curl
     6  #- counter over grpc, curl
     7  #- counter over grpc, grpc
     8  
     9  # TODO: install everything
    10  
    11  export PATH="$GOBIN:$PATH"
    12  export TMHOME=$HOME/.tendermint_app
    13  
    14  function kvstore_over_socket(){
    15      rm -rf $TMHOME
    16      tendermint init
    17      echo "Starting kvstore_over_socket"
    18      abci-cli kvstore > /dev/null &
    19      pid_kvstore=$!
    20      tendermint node > tendermint.log &
    21      pid_tendermint=$!
    22      sleep 5
    23  
    24      echo "running test"
    25      bash test/app/kvstore_test.sh "KVStore over Socket"
    26  
    27      kill -9 $pid_kvstore $pid_tendermint
    28  }
    29  
    30  # start tendermint first
    31  function kvstore_over_socket_reorder(){
    32      rm -rf $TMHOME
    33      tendermint init
    34      echo "Starting kvstore_over_socket_reorder (ie. start tendermint first)"
    35      tendermint node > tendermint.log &
    36      pid_tendermint=$!
    37      sleep 2
    38      abci-cli kvstore > /dev/null &
    39      pid_kvstore=$!
    40      sleep 5
    41  
    42      echo "running test"
    43      bash test/app/kvstore_test.sh "KVStore over Socket"
    44  
    45      kill -9 $pid_kvstore $pid_tendermint
    46  }
    47  
    48  
    49  function counter_over_socket() {
    50      rm -rf $TMHOME
    51      tendermint init
    52      echo "Starting counter_over_socket"
    53      abci-cli counter --serial > /dev/null &
    54      pid_counter=$!
    55      tendermint node > tendermint.log &
    56      pid_tendermint=$!
    57      sleep 5
    58  
    59      echo "running test"
    60      bash test/app/counter_test.sh "Counter over Socket"
    61  
    62      kill -9 $pid_counter $pid_tendermint
    63  }
    64  
    65  function counter_over_grpc() {
    66      rm -rf $TMHOME
    67      tendermint init
    68      echo "Starting counter_over_grpc"
    69      abci-cli counter --serial --abci grpc > /dev/null &
    70      pid_counter=$!
    71      tendermint node --abci grpc > tendermint.log &
    72      pid_tendermint=$!
    73      sleep 5
    74  
    75      echo "running test"
    76      bash test/app/counter_test.sh "Counter over GRPC"
    77  
    78      kill -9 $pid_counter $pid_tendermint
    79  }
    80  
    81  function counter_over_grpc_grpc() {
    82      rm -rf $TMHOME
    83      tendermint init
    84      echo "Starting counter_over_grpc_grpc (ie. with grpc broadcast_tx)"
    85      abci-cli counter --serial --abci grpc > /dev/null &
    86      pid_counter=$!
    87      sleep 1
    88      GRPC_PORT=36656
    89      tendermint node --abci grpc --rpc.grpc_laddr tcp://localhost:$GRPC_PORT > tendermint.log &
    90      pid_tendermint=$!
    91      sleep 5
    92  
    93      echo "running test"
    94      GRPC_BROADCAST_TX=true bash test/app/counter_test.sh "Counter over GRPC via GRPC BroadcastTx"
    95  
    96      kill -9 $pid_counter $pid_tendermint
    97  }
    98  
    99  case "$1" in 
   100      "kvstore_over_socket")
   101      kvstore_over_socket
   102      ;;
   103  "kvstore_over_socket_reorder")
   104      kvstore_over_socket_reorder
   105      ;;
   106      "counter_over_socket")
   107      counter_over_socket
   108      ;;
   109  "counter_over_grpc")
   110      counter_over_grpc
   111      ;;
   112      "counter_over_grpc_grpc")
   113      counter_over_grpc_grpc
   114      ;;
   115  *)
   116      echo "Running all"
   117      kvstore_over_socket
   118      echo ""
   119      kvstore_over_socket_reorder
   120      echo ""
   121      counter_over_socket
   122      echo ""
   123      counter_over_grpc
   124      echo ""
   125      counter_over_grpc_grpc
   126  esac
   127