-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
test(exex): introduce utils for testing #8636
Conversation
34bcb98
to
68c1d42
Compare
68c1d42
to
b21619e
Compare
crates/exex-test-utils/src/lib.rs
Outdated
type TmpDB = Arc<TempDatabase<DatabaseEnv>>; | ||
type Adapter = NodeAdapter< | ||
RethFullAdapter<TmpDB, TestNode>, | ||
<<TestNode as Node<FullNodeTypesAdapter<TestNode, TmpDB, BlockchainProvider<TmpDB>>>>::ComponentsBuilder as NodeComponentsBuilder< | ||
RethFullAdapter<TmpDB, TestNode>, | ||
>>::Components, | ||
>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should do smth about this,
not loving how this looks -.-
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
took me a while to get all the types right :D
examples/exex/minimal/src/main.rs
Outdated
let TestExExContext { ctx, genesis, provider_factory: _, mut events_rx, notifications_tx } = | ||
test_exex_context().await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want a wrapper type for anything besides the ctx
so that we add helper functions, like emit chain committed and assert functions for receiving etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah good idea
use reth_exex::{ExExEvent, ExExNotification}; | ||
use reth_exex_test_utils::{test_exex_context, PollOnce, TestExExContext}; | ||
|
||
#[tokio::test] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should likely use multi-thread flavor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsure, why? we're not running the node
6d86c4d
to
262d637
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm,
perhaps we can introduce something like an exextestbuilder and can get rid of the aliases this way
Closes #8545
This requires a separate crate and not just a
test-utils
feature for thereth-exex
crate, because we depend onreth-node-builder
which in turn depends onreth-exex
, creating a circular dependency.The next step is to give out to the caller the control over
TestPool
and other dependencies that may want to be mocked for testing purposes.