Add simple integration test between Channel and Router #2268
Closed
Add simple integration test between Channel and Router #2268
Channel and Router #2268Conversation
pm47
commented
May 13, 2022
Comment on lines
+62
to
+67
| // this allows overriding the default eventstream in tests | ||
| val eventStream = eventStream_opt.getOrElse(context.system.eventStream) | ||
|
|
||
| eventStream.subscribe(self, classOf[LocalChannelUpdate]) | ||
| eventStream.subscribe(self, classOf[LocalChannelDown]) | ||
| eventStream.subscribe(self, classOf[AvailableBalanceChanged]) |
Member
Author
There was a problem hiding this comment.
This is a bit dirty: we only override the event stream for subscriptions. It's enough for testing, and it was not possible to update all references in Validation, RouteCalculation, Syncing etc. due to how the handlers are implemented. We could migrate them to the same technique as what we used for the channel fsm.
Channel and Router
This a minimal change that keep tests passing, but there is a lot of cleanup left to do. The issue with this technique is that we must not forget to call `this.eventStream` instead of `context.system.eventStream` from the `Channel` actor. However this would only affect tests since we use the default `eventStream` in production.
The test currently fails, which looks like a bug to me. When a local channel graduates from private to public, we do not copy existing known `channel_update`s. Current implementation guarantees that we will process our local `channel_update` immediately, but what about our peer?
We fix a second bug where gossip origin wasn't properly set for local announcements
a43aee8 to
e09360e
Compare
pm47
commented
May 13, 2022
Comment on lines
+151
to
+162
| val front1 = { | ||
| implicit val system: ActorSystem = system1 | ||
| TestFSMRef[FrontRouter.State, FrontRouter.Data, FrontRouter](new FrontRouter(nodeParams.routerConf, router)) | ||
| } | ||
| val front2 = { | ||
| implicit val system: ActorSystem = system2 | ||
| TestFSMRef[FrontRouter.State, FrontRouter.Data, FrontRouter](new FrontRouter(nodeParams.routerConf, router)) | ||
| } | ||
| val front3 = { | ||
| implicit val system: ActorSystem = system3 | ||
| TestFSMRef[FrontRouter.State, FrontRouter.Data, FrontRouter](new FrontRouter(nodeParams.routerConf, router)) | ||
| } |
Member
Author
There was a problem hiding this comment.
I just realized that this trick (providing a custom ActorSystem) would also make it possible to segregate event streams in tests. Should I do that instead of 40cc09f? I think I should 😅
Member
Author
|
Superseded by #2270. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR we add a basic integration test between
ChannelandRouterthat checks the proper handling of local announcements.This test found two bugs, fixed in two separate commits.