update fixturenet-eth test #600

Merged
iskay merged 2 commits from iskay/fixturenet-eth-test into main 2023-10-24 22:21:30 +00:00
2 changed files with 68 additions and 7 deletions

29
.github/workflows/fixturenet-eth.yml vendored Normal file
View File

@ -0,0 +1,29 @@
Review

Add trailing newline please.

Add trailing newline please.
Review

Add trailing newline please.

Add trailing newline please.
name: Fixturenet-Eth Test
Review

Add trailing newline please.

Add trailing newline please.
Review

Add trailing newline please.

Add trailing newline please.
on:
Review

Add trailing newline please.

Add trailing newline please.
pull_request:
Review

Add trailing newline please.

Add trailing newline please.
branches: '*'
Review

Add trailing newline please.

Add trailing newline please.
push:
Review

Add trailing newline please.

Add trailing newline please.
branches: '*'
Review

Add trailing newline please.

Add trailing newline please.
Review

Add trailing newline please.

Add trailing newline please.
jobs:
Review

Add trailing newline please.

Add trailing newline please.
test:
Review

Add trailing newline please.

Add trailing newline please.
name: "Run fixturenet-eth test suite"
Review

Add trailing newline please.

Add trailing newline please.
runs-on: ubuntu-latest
Review

Add trailing newline please.

Add trailing newline please.
steps:
Review

Add trailing newline please.

Add trailing newline please.
- name: "Clone project repository"
Review

Add trailing newline please.

Add trailing newline please.
uses: actions/checkout@v3
Review

Add trailing newline please.

Add trailing newline please.
- name: "Install Python"
Review

Add trailing newline please.

Add trailing newline please.
uses: actions/setup-python@v4
Review

Add trailing newline please.

Add trailing newline please.
with:
Review

Add trailing newline please.

Add trailing newline please.
python-version: '3.8'
Review

Add trailing newline please.

Add trailing newline please.
- name: "Print Python version"
Review

Add trailing newline please.

Add trailing newline please.
run: python3 --version
Review

Add trailing newline please.

Add trailing newline please.
- name: "Install shiv"
Review

Add trailing newline please.

Add trailing newline please.
run: pip install shiv
Review

Add trailing newline please.

Add trailing newline please.
- name: "Generate build version file"
Review

Add trailing newline please.

Add trailing newline please.
run: ./scripts/create_build_tag_file.sh
Review

Add trailing newline please.

Add trailing newline please.
- name: "Build local shiv package"
Review

Add trailing newline please.

Add trailing newline please.
run: ./scripts/build_shiv_package.sh
Review

Add trailing newline please.

Add trailing newline please.
- name: "Run fixturenet-eth tests"
Review

Add trailing newline please.

Add trailing newline please.
run: ./tests/fixturenet-eth/run-test.sh
Review

Add trailing newline please.

Add trailing newline please.

View File

@ -24,13 +24,45 @@ echo "$(date +"%Y-%m-%d %T"): Stack started"
$TEST_TARGET_SO --stack fixturenet-eth deploy ps $TEST_TARGET_SO --stack fixturenet-eth deploy ps
# echo "$(date +"%Y-%m-%d %T"): Getting stack status" # echo "$(date +"%Y-%m-%d %T"): Getting stack status"
# $TEST_TARGET_SO --stack fixturenet-eth deploy exec fixturenet-eth-bootnode-lighthouse /scripts/status-internal.sh # $TEST_TARGET_SO --stack fixturenet-eth deploy exec fixturenet-eth-bootnode-lighthouse /scripts/status-internal.sh
echo "$(date +"%Y-%m-%d %T"): Getting initial block number"
initial_block_number=$($TEST_TARGET_SO --stack fixturenet-eth deploy exec foundry "cast block-number") timeout=900 # 15 minutes
# Check that the block number increases some time later echo "$(date +"%Y-%m-%d %T"): Getting initial block number. Timeout set to $timeout seconds"
sleep 120 start_time=$(date +%s)
echo "$(date +"%Y-%m-%d %T"): Getting subsequent block number" elapsed_time=0
subsequent_block_number=$($TEST_TARGET_SO --stack fixturenet-eth deploy exec foundry "cast block-number") initial_block_number=0
while [ "$initial_block_number" -eq 0 ] && [ $elapsed_time -lt $timeout ]; do
sleep 10
echo "$(date +"%Y-%m-%d %T"): Waiting for initial block..."
initial_block_number=$($TEST_TARGET_SO --stack fixturenet-eth deploy exec foundry "cast block-number")
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
done
subsequent_block_number=$initial_block_number
# if initial block was 0 after timeout, assume chain did not start successfully and skip finding subsequent block
if [[ $initial_block_number -gt 0 ]]; then
timeout=300
echo "$(date +"%Y-%m-%d %T"): Getting subsequent block number. Timeout set to $timeout seconds"
start_time=$(date +%s)
elapsed_time=0
# wait for 5 blocks or timeout
while [ "$subsequent_block_number" -le $((initial_block_number + 5)) ] && [ $elapsed_time -lt $timeout ]; do
sleep 10
echo "$(date +"%Y-%m-%d %T"): Waiting for five blocks or $timeout seconds..."
subsequent_block_number=$($TEST_TARGET_SO --stack fixturenet-eth deploy exec foundry "cast block-number")
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
done
fi
# will return 0 if either of the above loops timed out
block_number_difference=$((subsequent_block_number - initial_block_number)) block_number_difference=$((subsequent_block_number - initial_block_number))
echo "$(date +"%Y-%m-%d %T"): Results of block height queries:"
echo "Initial block height: $initial_block_number"
echo "Subsequent block height: $subsequent_block_number"
# Block height difference should be between 1 and some small number # Block height difference should be between 1 and some small number
if [[ $block_number_difference -gt 1 && $block_number_difference -lt 100 ]]; then if [[ $block_number_difference -gt 1 && $block_number_difference -lt 100 ]]; then
echo "Test passed" echo "Test passed"
@ -41,7 +73,7 @@ else
$TEST_TARGET_SO --stack fixturenet-eth deploy logs $TEST_TARGET_SO --stack fixturenet-eth deploy logs
test_result=1 test_result=1
fi fi
$TEST_TARGET_SO --stack fixturenet-eth deploy down $TEST_TARGET_SO --stack fixturenet-eth deploy down --delete-volumes
echo "$(date +"%Y-%m-%d %T"): Removing cloned repositories" echo "$(date +"%Y-%m-%d %T"): Removing cloned repositories"
rm -rf $CERC_REPO_BASE_DIR rm -rf $CERC_REPO_BASE_DIR
echo "$(date +"%Y-%m-%d %T"): Test finished" echo "$(date +"%Y-%m-%d %T"): Test finished"