Skip to content
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

Merged
merged 11 commits into from
Jun 6, 2024
Merged

test(exex): introduce utils for testing #8636

merged 11 commits into from
Jun 6, 2024

Conversation

shekhirin
Copy link
Collaborator

@shekhirin shekhirin commented Jun 6, 2024

Closes #8545

This requires a separate crate and not just a test-utils feature for the reth-exex crate, because we depend on reth-node-builder which in turn depends on reth-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.

@shekhirin shekhirin added C-test A change that impacts how or what we test A-exex Execution Extensions labels Jun 6, 2024
@shekhirin shekhirin changed the title feat(exex): test utils test(exex): introduce utils for testing Jun 6, 2024
@shekhirin shekhirin force-pushed the alexey/exex-testing branch 2 times, most recently from 34bcb98 to 68c1d42 Compare June 6, 2024 10:56
@shekhirin shekhirin force-pushed the alexey/exex-testing branch from 68c1d42 to b21619e Compare June 6, 2024 10:59
@shekhirin shekhirin requested a review from mattsse June 6, 2024 10:59
@shekhirin shekhirin marked this pull request as ready for review June 6, 2024 11:05
@shekhirin shekhirin requested review from onbjerg and gakonst as code owners June 6, 2024 11:05
Comment on lines 117 to 123
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,
>;
Copy link
Collaborator

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 -.-

Copy link
Collaborator Author

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

Comment on lines 66 to 67
let TestExExContext { ctx, genesis, provider_factory: _, mut events_rx, notifications_tx } =
test_exex_context().await?;
Copy link
Collaborator

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

Copy link
Collaborator Author

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]
Copy link
Collaborator

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

Copy link
Collaborator Author

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

@shekhirin shekhirin force-pushed the alexey/exex-testing branch from 6d86c4d to 262d637 Compare June 6, 2024 11:43
Copy link
Collaborator

@mattsse mattsse left a 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

@shekhirin shekhirin enabled auto-merge June 6, 2024 13:19
@shekhirin shekhirin added this pull request to the merge queue Jun 6, 2024
Merged via the queue into main with commit 40d8ac0 Jun 6, 2024
30 checks passed
@shekhirin shekhirin deleted the alexey/exex-testing branch June 6, 2024 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-exex Execution Extensions C-test A change that impacts how or what we test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add testing framework for ExEx
2 participants