-
Notifications
You must be signed in to change notification settings - Fork 282
Define a proper base class for fixture tests #2286
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e708618
update test dependencies
pm47 f28bedd
add node alias to log MDC for tests
pm47 0428509
proper base class for fixture tests
pm47 3ef4f44
adapt WaitForOpenChannelStateSpec to new fixture
pm47 2632be3
fix race condition in peerconnection
pm47 293725d
human-readable nodeId for alice/bob
pm47 f175570
fix sqlite db roundtrip check
pm47 2e6e566
use eclair default params in integration tests
pm47 3d42e3a
address review comments
pm47 3376a93
fixup! fix race condition in peerconnection
pm47 fb2e439
Revert "adapt WaitForOpenChannelStateSpec to new fixture"
pm47 ffeb8e5
fixup! address review comments
pm47 202521b
remove ChannelStateTestsHelperMethods dependencies
pm47 2da5a97
merge ChannelStateTestsBase and ChannelStateTestsHelperMethods
pm47 8833eae
replace all === by ==
pm47 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ | |
|
|
||
| package fr.acinq.eclair.io | ||
|
|
||
| import akka.actor.{ActorRef, FSM, OneForOneStrategy, PoisonPill, Props, SupervisorStrategy, Terminated} | ||
| import akka.actor.{ActorRef, FSM, OneForOneStrategy, PoisonPill, Props, Stash, SupervisorStrategy, Terminated} | ||
| import akka.event.Logging.MDC | ||
| import fr.acinq.bitcoin.scalacompat.ByteVector32 | ||
| import fr.acinq.bitcoin.scalacompat.Crypto.PublicKey | ||
|
|
@@ -28,7 +28,7 @@ import fr.acinq.eclair.remote.EclairInternalsSerializer.RemoteTypes | |
| import fr.acinq.eclair.router.Router._ | ||
| import fr.acinq.eclair.wire.protocol | ||
| import fr.acinq.eclair.wire.protocol._ | ||
| import fr.acinq.eclair.{FSMDiagnosticActorLogging, Feature, Features, InitFeature, Logs, TimestampMilli, TimestampSecond} | ||
| import fr.acinq.eclair.{FSMDiagnosticActorLogging, Features, InitFeature, Logs, TimestampMilli, TimestampSecond} | ||
| import scodec.Attempt | ||
| import scodec.bits.ByteVector | ||
|
|
||
|
|
@@ -56,7 +56,7 @@ import scala.util.Random | |
| * | ||
| * Created by PM on 11/03/2020. | ||
| */ | ||
| class PeerConnection(keyPair: KeyPair, conf: PeerConnection.Conf, switchboard: ActorRef, router: ActorRef) extends FSMDiagnosticActorLogging[PeerConnection.State, PeerConnection.Data] { | ||
| class PeerConnection(keyPair: KeyPair, conf: PeerConnection.Conf, switchboard: ActorRef, router: ActorRef) extends FSMDiagnosticActorLogging[PeerConnection.State, PeerConnection.Data] with Stash { | ||
|
|
||
| import PeerConnection._ | ||
|
|
||
|
|
@@ -95,6 +95,11 @@ class PeerConnection(keyPair: KeyPair, conf: PeerConnection.Conf, switchboard: A | |
| log.warning(s"authentication timed out after ${conf.authTimeout}") | ||
| d.pendingAuth.origin_opt.foreach(_ ! ConnectionResult.AuthenticationFailed("authentication timed out")) | ||
| stop(FSM.Normal) | ||
|
|
||
| case Event(_: protocol.Init, _) => | ||
| log.debug("stashing remote init") | ||
| stash() | ||
| stay() | ||
| } | ||
|
|
||
| when(BEFORE_INIT) { | ||
|
|
@@ -108,7 +113,13 @@ class PeerConnection(keyPair: KeyPair, conf: PeerConnection.Conf, switchboard: A | |
| } | ||
| d.transport ! localInit | ||
| startSingleTimer(INIT_TIMER, InitTimeout, conf.initTimeout) | ||
| unstashAll() // unstash remote init if it already arrived | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NB: I'm only |
||
| goto(INITIALIZING) using InitializingData(chainHash, d.pendingAuth, d.remoteNodeId, d.transport, peer, localInit, doSync, d.isPersistent) | ||
|
|
||
| case Event(_: protocol.Init, _) => | ||
| log.debug("stashing remote init") | ||
| stash() | ||
| stay() | ||
| } | ||
|
|
||
| when(INITIALIZING) { | ||
|
|
||
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
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
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
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
Oops, something went wrong.
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.
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.
Another pretty good reason not to use
TestActorRefis that it is not compatible withStash(https://stackoverflow.com/a/18377939).Stashallows us to nicely handle race conditions between messages, instead of delaying them, which creates other race conditions (which is exactly what happened in my attempted fix 2632be3).