-
Notifications
You must be signed in to change notification settings - Fork 5
tests: add test fixture for easier abstraction #407
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
base: main
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #407 will not alter performanceComparing Summary
|
| pub fn sequencer() -> TestFixtureBuilder { | ||
| TestFixtureBuilder::new().with_sequencer() | ||
| } | ||
|
|
||
| /// Create a new test fixture builder for follower nodes. | ||
| pub fn followers(count: usize) -> TestFixtureBuilder { | ||
| TestFixtureBuilder::new().with_nodes(count) | ||
| } |
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.
Should these methods instead consume self so we can chain them? Something like TestFixture::builder().sequencer().followers(2)
| /// The underlying node context. | ||
| pub node: NodeHelperType<ScrollRollupNode, TestBlockChainProvider>, | ||
| /// Engine instance for this node. | ||
| pub engine: Engine<ScrollAuthApiEngineClient<EC>>, |
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.
Can you erase the type here using:
pub engine: Engine<dyn ScrollEngineApi>,| let events = &mut self.fixture.nodes[self.node_index].chain_orchestrator_rx; | ||
|
|
||
| let result = timeout(self.timeout_duration, async { | ||
| while let Some(event) = events.next().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.
For debugging purposes we should log all events here (matching and non matching). This makes it much easier to understand which events are being processed/fired instead of the expected one. Similar to what is done in wait_for_event_predicate
PR for the update of the test setup. Provides a set of high level abstractions that allow testers to easily set up initial tests conditions, run the test and directly expect test outcome.