Skip to content

feat(code/test): Middleware for testing #948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 1, 2025
Merged

feat(code/test): Middleware for testing #948

merged 4 commits into from
Apr 1, 2025

Conversation

romac
Copy link
Member

@romac romac commented Mar 31, 2025

Add a Middleware to the TestContext to override how votes and proposals are built, allowing us to change what a node votes or proposes on a per-test basis.

This was extracted from #896 to make it easier to review that PR.


  • Make new_prevote, new_precommit and new_proposal methods of Context instead of static functions

  • Stuff middleware in the TestContext instead of static variable

  • Remove unused dependency

  • Add way to access middleware from TestContext


PR author checklist

For all contributors

For external contributors

…osals are built

* Make `new_prevote`, `new_precommit` and `new_proposal` methods of `Context` instead of static functions

* Stuff middleware in the `TestContext` instead of static variable

* Remove unused dependency

* Add way to access middleware from TestContext
@romac romac requested a review from ancazamfir as a code owner March 31, 2025 13:30
@romac
Copy link
Member Author

romac commented Apr 1, 2025

@ancazamfir Nevermind my comments above (now deleted), I was wrong.

@romac romac force-pushed the romac/ctx-middleware branch from 5297d76 to 19893e4 Compare April 1, 2025 14:26
Copy link

codecov bot commented Apr 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (3b291f7) to head (19893e4).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@     Coverage Diff     @@
##   main   #948   +/-   ##
===========================
===========================
Components Coverage Δ
core ∅ <ø> (∅)
engine ∅ <ø> (∅)
app ∅ <ø> (∅)
starknet ∅ <ø> (∅)

@romac romac merged commit f7963ff into main Apr 1, 2025
18 checks passed
@romac romac deleted the romac/ctx-middleware branch April 1, 2025 15:16
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.

1 participant