Fix doppelganger tests

This commit is contained in:
Pawan Dhananjay
2023-03-23 19:45:03 +05:30
parent 93fb6f3a78
commit 0b92b204a8
5 changed files with 41 additions and 28 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Requires `lighthouse`, ``lcli`, `ganache`, `curl`, `jq`
# Requires `lighthouse`, ``lcli`, `geth`, `curl`, `jq`
BEHAVIOR=$1
@@ -15,21 +15,15 @@ exit_if_fails() {
$@
EXIT_CODE=$?
if [[ $EXIT_CODE -eq 1 ]]; then
exit 111
exit 1
fi
}
genesis_file=$2
source ./vars.env
exit_if_fails ../local_testnet/clean.sh
echo "Starting ganache"
exit_if_fails ../local_testnet/ganache_test_node.sh &> /dev/null &
GANACHE_PID=$!
# Wait for ganache to start
sleep 5
echo "Setting up local testnet"
@@ -43,16 +37,30 @@ echo "Starting bootnode"
exit_if_fails ../local_testnet/bootnode.sh &> /dev/null &
BOOT_PID=$!
exit_if_fails ../local_testnet/el_bootnode.sh &> /dev/null &
EL_BOOT_PID=$!
# wait for the bootnode to start
sleep 10
echo "Starting local execution nodes"
exit_if_fails ../local_testnet/geth.sh $HOME/.lighthouse/local-testnet/geth_datadir1 7000 6000 5000 $genesis_file &> geth.log &
EL_PID=$!
exit_if_fails ../local_testnet/geth.sh $HOME/.lighthouse/local-testnet/geth_datadir2 7100 6100 5100 $genesis_file &> /dev/null &
EL_PID2=$!
exit_if_fails ../local_testnet/geth.sh $HOME/.lighthouse/local-testnet/geth_datadir3 7200 6200 5200 $genesis_file &> /dev/null &
EL_PID3=$!
sleep 20
echo "Starting local beacon nodes"
exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_1 9000 8000 &> /dev/null &
exit_if_fails ../local_testnet/beacon_node.sh -d debug $HOME/.lighthouse/local-testnet/node_1 9000 8000 http://localhost:5000 $HOME/.lighthouse/local-testnet/geth_datadir1/geth/jwtsecret &> beacon.log &
BEACON_PID=$!
exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_2 9100 8100 &> /dev/null &
exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_2 9100 8100 http://localhost:5100 $HOME/.lighthouse/local-testnet/geth_datadir2/geth/jwtsecret &> /dev/null &
BEACON_PID2=$!
exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_3 9200 8200 &> /dev/null &
exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_3 9200 8200 http://localhost:5200 $HOME/.lighthouse/local-testnet/geth_datadir3/geth/jwtsecret &> /dev/null &
BEACON_PID3=$!
echo "Starting local validator clients"
@@ -79,7 +87,7 @@ if [[ "$BEHAVIOR" == "failure" ]]; then
echo "Shutting down"
# Cleanup
kill $BOOT_PID $BEACON_PID $BEACON_PID2 $BEACON_PID3 $GANACHE_PID $VALIDATOR_1_PID $VALIDATOR_2_PID $VALIDATOR_3_PID
kill $BOOT_PID $BEACON_PID $BEACON_PID2 $BEACON_PID3 $EL_BOOT_PID $EL_PID $EL_PID2 $EL_PID3 $VALIDATOR_1_PID $VALIDATOR_2_PID $VALIDATOR_3_PID
echo "Done"
@@ -144,7 +152,7 @@ if [[ "$BEHAVIOR" == "success" ]]; then
# Cleanup
cd $PREVIOUS_DIR
kill $BOOT_PID $BEACON_PID $BEACON_PID2 $BEACON_PID3 $GANACHE_PID $VALIDATOR_1_PID $VALIDATOR_2_PID $VALIDATOR_3_PID $VALIDATOR_4_PID
kill $BOOT_PID $BEACON_PID $BEACON_PID2 $BEACON_PID3 $EL_BOOT_PID $EL_PID $EL_PID2 $EL_PID3 $VALIDATOR_1_PID $VALIDATOR_2_PID $VALIDATOR_3_PID $VALIDATOR_4_PID
echo "Done"