diff --git a/tests/fixturenet-plugeth-stack/run-test.sh b/tests/fixturenet-plugeth-stack/run-test.sh index aa64861..a197735 100755 --- a/tests/fixturenet-plugeth-stack/run-test.sh +++ b/tests/fixturenet-plugeth-stack/run-test.sh @@ -56,7 +56,7 @@ test_deployment_spec=$CERC_REPO_BASE_DIR/test-deployment-spec.yml $SO_COMMAND --stack ${stack_name} deploy init --output $test_deployment_spec # Check the file now exists if [ ! -f "$test_deployment_spec" ]; then - test_fail_exit "deploy init test: spec fille not present" + test_fail_exit "deploy init test: spec file not present" fi echo "deploy init test: passed" @@ -109,18 +109,24 @@ log_info "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 -if [[ $block_number_difference -gt 1 && $block_number_difference -lt 100 ]]; then - echo "Test passed" - test_result=0 -else - echo "Test failed: block numbers were ${initial_block_number} and ${subsequent_block_number}" - echo "Logs from stack:" +dump_logs () { + echo "Test failed. Logs from stack:" $SO_COMMAND deployment --dir $test_deployment_dir logs - test_result=1 -fi -$SO_COMMAND deployment --dir $test_deployment_dir stop --delete-volumes -log_info "Removing cloned repositories" -rm -rf $CERC_REPO_BASE_DIR -log_info "Test finished" -exit $test_result +} +trap dump_logs ERR + +# Block height difference should be between 1 and some small number +[[ $block_number_difference -gt 1 && $block_number_difference -lt 100 ]] + +# Check that the block hash is present in the ipld-eth-db +echo "Querying ipld-eth-db for block number $subsequent_block_number" +block_hash_query="SELECT block_hash from eth.header_cids where block_number = $subsequent_block_number" +block_hash=$( + $SO_COMMAND deployment --dir $test_deployment_dir exec ipld-eth-db \ + "psql -qtA -U vdbm -c '$block_hash_query' cerc_testing" +) +echo "Block hash in ipld-eth-db: $block_hash" + +[[ -n $block_hash ]] + +echo "Test passed."