Skip to content

Commit

Permalink
Fix bats test for ckb run
Browse files Browse the repository at this point in the history
Signed-off-by: Eval EXEC <execvy@gmail.com>
  • Loading branch information
eval-exec committed Jul 3, 2023
1 parent a9ef6f0 commit 4cb2b46
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions util/app-config/src/tests/ckb_run_replay.bats
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ bats_load_library 'bats-assert'
bats_load_library 'bats-support'

_ckb_run() {
ckb run -C ${CKB_DIRNAME} 1>${TMP_DIR}/ckb_run.log 2>&1 &
echo $! >${TMP_DIR}/ckb_run.pid
ckb run -C ${CKB_DIRNAME} &> ${TMP_DIR}/ckb_run.log &
PID=$!
sleep 5
kill "$(<"${TMP_DIR}/ckb_run.pid")"
kill ${PID}

while kill -0 ${PID}; do
echo "waiting for ckb to exit"
sleep 1
done
tail -n 50 ${TMP_DIR}/ckb_run.log
}

_ckb_replay() {
# from 1 to 2500 enough to trigger profile action
CKB_LOG=err ckb replay -C ${CKB_DIRNAME} --tmp-target ${TMP_DIR} --profile 1 2500
Expand All @@ -18,7 +24,7 @@ function ckb_run { #@test
run _ckb_run
[ "$status" -eq 0 ]
# assert_output --regexp "ckb_chain::chain.*block number:.*, hash:.*, size:.*, cycles:.*"
assert_output --regexp "ckb_bin::subcommand::run Finishing work, please wait"
assert_output --regexp "ckb_bin all tokio tasks have been stopped"
}

function ckb_replay { #@test
Expand Down

0 comments on commit 4cb2b46

Please sign in to comment.