Skip to content

refactor: replace manual mocks with mockall in producer#3192

Open
raushan728 wants to merge 6 commits intoFuelLabs:masterfrom
raushan728:refactor/mockall-migration-producer
Open

refactor: replace manual mocks with mockall in producer#3192
raushan728 wants to merge 6 commits intoFuelLabs:masterfrom
raushan728:refactor/mockall-migration-producer

Conversation

@raushan728
Copy link

Migrated manual mock implementations in producer/src/mocks.rs to mockall to address internal TODOs and standardize testing infrastructure.

@fuel-cla-bot
Copy link

fuel-cla-bot bot commented Jan 27, 2026

Thanks for the contribution! Before we can merge this, we need @raushan728 to sign the Fuel Labs Contributor License Agreement.

@cursor
Copy link

cursor bot commented Jan 27, 2026

PR Summary

Standardizes producer test infrastructure by replacing hand-rolled mocks with mockall and small factory helpers.

  • Introduces mockall-based mocks for Relayer, TxPool, and Executor in producer/src/mocks.rs, plus helpers: create_mock_relayer, create_mock_txpool, create_mock_executor, and create_failing_mock_executor (replaces FailingMockExecutor)
  • Updates tests to use the new helpers and mock types, including TestContext and TestContextBuilder construction paths
  • Keeps MockExecutorWithCapture and MockDb test utilities; no production logic changes beyond a minor formatting fix in block_producer.rs

Written by Cursor Bugbot for commit 041a442. This will update automatically on new commits. Configure here.

Copy link
Collaborator

@xgreenx xgreenx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please apply nightly formatting?

@raushan728
Copy link
Author

Applied nightly formatting as requested. All imports are now in vertical layout format.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@raushan728 raushan728 requested a review from xgreenx January 28, 2026 13:20
@MitchTurner
Copy link
Member

Hey @raushan728 !

Thanks for the contribution! It's a little bit of an internal debate whether or not we should use mockall in our code. I'm of mind that we should manually write our mocks as mockall encourages users to pay too much attention to implementation details, rather than just testing external apis.

It's not up to me alone, but that's my position.

@raushan728
Copy link
Author

Thanks @MitchTurner. I'll wait for the team's final decision on this before making further changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants