Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
anonymousGiga committed Jul 11, 2024
1 parent 3df605b commit c46f8d8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
24 changes: 14 additions & 10 deletions testing/it-test/github-action/action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ terminate_processes() {
trap 'terminate_processes' ERR

# Function to check if historical sync success
assert_string_in_file() {
assert_pipeline_finished() {
local file_path=$1
local search_string=$2

if grep -q "$search_string" "$file_path"; then
echo "Assertion passed: String found in the file."
if grep -qE 'Finished stage.*pipeline_stages.*12/12' "$file_path"; then
echo "Assertion passed: Required line found in the file."
return 0
else
echo "Assertion failed: String not found in the file."
echo "Assertion failed: Required line not found in the file."
return 1
fi
}



#1.Config
./config.sh
./update_el_genesis_json.sh # Update time of genesis.json
./generate_validator_keystores.sh # Generate keys

#2.Start producer
duration=20m # Set reth node duration time=20m
duration=5m # Set reth node duration time=20m

timeout $duration bash start-reth1.sh &
pids+=($!)
Expand Down Expand Up @@ -71,8 +71,7 @@ wait ${pids[-1]}
echo "after first historical sync"
# Check if historical1.sh execution failed
file_path="./his1.log"
search_string="Finished stage pipeline_stages=12/12"
assert_string_in_file "$file_path" "$search_string"
assert_pipeline_finished "$file_path"

if [ $? -ne 0 ]; then
terminate_processes
Expand All @@ -85,8 +84,7 @@ echo "second historical sync"

# Check if historical2.sh execution failed
file_path="./his2.log"
search_string="Finished stage pipeline_stages=12/12"
assert_string_in_file "$file_path" "$search_string"
assert_pipeline_finished "$file_path"

if [ $? -ne 0 ]; then
terminate_processes
Expand All @@ -98,6 +96,12 @@ fi

#7. End
wait "${pids[@]}"

file_path="./his1.log"
assert_pipeline_finished "$file_path"
file_path="./his2.log"
assert_pipeline_finished "$file_path"

exit


6 changes: 3 additions & 3 deletions testing/it-test/github-action/historical1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ reth1_node=$(curl --data '{"jsonrpc":"2.0","method":"admin_nodeInfo","params":[]
| jq .result.enode | sed -e "s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/${IP_ADDRESS}/g" | sed 's/\"//g');
echo $reth1_node

BLOCK_NUMBER=10
BLOCK_NUMBER=100
TIP=""
#while [ -z "$TIP" ] || [ "$TIP" == "null" ]; do
while [ -z "$TIP" ]; do
while [ -z "$TIP" ] || [ "$TIP" == "null" ]; do
# while [ -z "$TIP" ]; do
RES=$(curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x'$(printf "%x" $BLOCK_NUMBER)'", true],"id":1}' http://$IP_ADDRESS:${EL_RETH_1_HTTP_PORT})
TIP=$(echo $RES | jq -r '.result.hash')
if [ "$TIP" == "null" ]; then
Expand Down

0 comments on commit c46f8d8

Please sign in to comment.