-
-
Notifications
You must be signed in to change notification settings - Fork 291
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: remove chain mocks #5582
test: remove chain mocks #5582
Conversation
Performance Report✔️ no performance regression detected Full benchmark results
|
I like the motivation, but the e2e tests are failing |
@@ -105,7 +103,6 @@ export class Network implements INetwork { | |||
this.chain.emitter.on(routes.events.EventType.head, this.onHead); | |||
this.chain.emitter.on(routes.events.EventType.lightClientFinalityUpdate, this.onLightClientFinalityUpdate); | |||
this.chain.emitter.on(routes.events.EventType.lightClientOptimisticUpdate, this.onLightClientOptimisticUpdate); | |||
modules.signal.addEventListener("abort", this.close.bind(this), {once: true}); |
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 is a terrible idea, debugging tests I discovered that close() is being called twice:
- first time through AbortController, not awaited, uncontrolled
- second time via close() but since it's second time it has no effect
This broke the expected close flow from the caller, causing issues in subsequent tests
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.
While attempting to fix the use of BeaconChain mock in network tests, I noticed that they can use the actual BeaconChain class and it works fine.
So the big refactor of the last commit is adding a new function getNetworkForTest()
which instantiates a network class with the real BeaconChain thing as dependency
f484b0f
to
49ed179
Compare
🎉 This PR is included in v1.9.0 🎉 |
Motivation
MockBeaconChain class is very annoying to have to update everytime we change its interface. It's actually unnecessary, so this PR just drops it completely.
Description
Remove manual chain mocks of: