github.com/aergoio/aergo@v1.3.1/consensus/impl/raftv2/test/init_test.sh (about)

     1  #!/usr/bin/env bash
     2  # generate id, BP11001.toml ~ BP1100[N].toml
     3  # this script must run at most once before testing
     4  
     5  source set_test_env.sh
     6  source $TEST_RAFT_HOME/test_common.sh 
     7  
     8  echo "################################################################################"
     9  echo " INITIALIZE RAFT TEST "
    10  echo ""
    11  echo ""
    12  echo " TEST_RAFT_HOME=$TEST_RAFT_HOME"
    13  echo " TEST_RAFT_INSTANCE_CONF=$TEST_RAFT_INSTANCE_CONF"
    14  echo "################################################################################"
    15  
    16  cd $TEST_RAFT_HOME
    17  echo "rm -rf $TEST_RAFT_INSTANCE"
    18  echo "mkdir -p $TEST_RAFT_INSTANCE"
    19  rm -rf $TEST_RAFT_INSTANCE
    20  mkdir -p $TEST_RAFT_INSTANCE
    21  mkdir -p $TEST_RAFT_INSTANCE_DATA
    22  mkdir -p $TEST_RAFT_INSTANCE_CLIENT
    23  
    24  # change datadir in config files
    25  echo "copy config files to temporary instance directory"
    26  echo "cp -rf $TEST_RAFT_CONF $TEST_RAFT_INSTANCE_CONF"
    27  cp -rf $TEST_RAFT_CONF $TEST_RAFT_INSTANCE_CONF
    28  
    29  echo "pushd $TEST_RAFT_INSTANCE_CONF"
    30  pushd $TEST_RAFT_INSTANCE_CONF
    31  
    32  for i in $(seq 1 7); do 
    33  	mynodename="aergo$i"
    34  	mysvrname=${svrname[$mynodename]}
    35  	svrport=${svrports[$mynodename]}
    36  	echo "$mynodename, $mysvrname, $svrport"
    37  
    38  	echo "do_sed.sh $mysvrname _data_ $TEST_RAFT_INSTANCE_DATA/$svrport ="
    39  	do_sed.sh $mysvrname  _data_ "$TEST_RAFT_INSTANCE_DATA/$svrport" "="
    40  done
    41  
    42  popd
    43  
    44  cp -rf $TEST_RAFT_INSTANCE_CONF/1100*.* $TEST_RAFT_INSTANCE
    45  cp -rf $TEST_RAFT_INSTANCE_CONF/arglog.* $TEST_RAFT_INSTANCE
    46  
    47  echo " Initialize Done!"
    48  echo "################################################################################"