Skip to content

test: add comprehensive rollback on inner call failure tests (#1539) - #1704

Merged
Baskarayelu merged 2 commits into
Remitwise-Org:mainfrom
sheyman546:fix/1539-rollback-inner-call-tests
Jul 30, 2026
Merged

test: add comprehensive rollback on inner call failure tests (#1539)#1704
Baskarayelu merged 2 commits into
Remitwise-Org:mainfrom
sheyman546:fix/1539-rollback-inner-call-tests

Conversation

@sheyman546

Copy link
Copy Markdown
Contributor

Closes #1539

Summary

Adds comprehensive rollback and compensation tests that supplement the existing signed-flow coverage by exercising the unsigned and fan-out paths.

Changes

New test mocks

  • mock_unsigned_fail_bill::Contract — bill payment step panics; compensation (reverse) methods succeed
  • mock_unsigned_fail_insurance::Contract — insurance premium step panics; compensation methods succeed

New tests

Test What it covers
test_unsigned_rollback_bill_failure_returns_rolled_back Unsigned flow: bill fails after savings → RemittanceFlowRolledBack
test_unsigned_rollback_insurance_failure_returns_rolled_back Unsigned flow: insurance fails after savings+bills → RemittanceFlowRolledBack
test_unsigned_rollback_first_step_fails_no_compensation Unsigned flow: first step fails → CrossContractCallFailed (nothing to comp)
test_fanout_flow_does_not_compensate_on_bill_failure Fan-out flow: bill fails → CrossContractCallFailed (no compensation applied)

Testing

  • All 4 new tests follow the existing patterns (Env::default(), mock_all_auths(), etc.)
  • Lock release and nonce management verified on all failure paths
  • The existing signed-flow rollback tests pass unchanged

Background

Issue #1539 requested tests for rollback on inner call failure. The signed-flow rollback tests already existed; this PR adds the unsigned and fan-out path coverage to close the gap.

@Baskarayelu
Baskarayelu merged commit 344f118 into Remitwise-Org:main Jul 30, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tests for rollback on inner call failure

2 participants