Skip to content

Commit

Permalink
test: retry example.bats
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts committed Dec 2, 2024
1 parent 0bdfbf2 commit fdb7761
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions bats/examples.bats
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ wait_for_new_import_job() {
exec_graphql 'list-accounts'
accounts_before=$(graphql_output '.data.accounts.nodes | length')

background cargo run --bin cala-ledger-example-rust > .rust-example-logs 2>&1

job_id=$(random_uuid)
variables=$(
jq -n \
Expand All @@ -42,14 +40,20 @@ wait_for_new_import_job() {
error_msg=$(graphql_output '.errors[0].message')
[[ "$name" == "rust-example" || "$error_msg" =~ duplicate.*jobs_name_key ]] || exit 1;

background cargo run --bin cala-ledger-example-rust > .rust-example-logs 2>&1

job_count=$(cat .e2e-logs | grep 'Executing CalaOutboxImportJob importing' | wc -l)
retry 20 1 wait_for_new_import_job $job_count || true
sleep 2
sleep 1

for i in {1..60}; do
exec_graphql 'list-accounts'
accounts_after=$(graphql_output '.data.accounts.nodes | length')
if [[ "$accounts_after" -gt "$accounts_before" ]] then
break;
fi
sleep 1
done

cat .rust-example-logs
cat .e2e-logs
exec_graphql 'list-accounts'
echo $(graphql_output)
accounts_after=$(graphql_output '.data.accounts.nodes | length')
[[ "$accounts_after" -gt "$accounts_before" ]] || exit 1
}

0 comments on commit fdb7761

Please sign in to comment.