-
Notifications
You must be signed in to change notification settings - Fork 283
Improve tests in #2224 #2314
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
Improve tests in #2224 #2314
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -213,11 +213,11 @@ class RestoreSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with Chan | |
| .modify(_.relayParams.privateChannelFees.feeBase).setTo(765 msat), | ||
| Alice.nodeParams | ||
| .modify(_.relayParams.privateChannelFees.feeProportionalMillionths).setTo(2345), | ||
| // Alice.nodeParams | ||
| // .modify(_.channelConf.expiryDelta).setTo(CltvExpiryDelta(147)), | ||
| // Alice.nodeParams | ||
| // .modify(_.relayParams.privateChannelFees.feeProportionalMillionths).setTo(2345) | ||
| // .modify(_.channelConf.expiryDelta).setTo(CltvExpiryDelta(147)), | ||
| Alice.nodeParams | ||
| .modify(_.channelConf.expiryDelta).setTo(CltvExpiryDelta(147)), | ||
| Alice.nodeParams | ||
| .modify(_.relayParams.privateChannelFees.feeProportionalMillionths).setTo(2345) | ||
| .modify(_.channelConf.expiryDelta).setTo(CltvExpiryDelta(147)), | ||
|
Comment on lines
+216
to
+220
Member
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. Oops |
||
| ) foreach { newConfig => | ||
|
|
||
| val newAlice: TestFSMRef[ChannelState, ChannelData, Channel] = TestFSMRef(new Channel(newConfig, wallet, Bob.nodeParams.nodeId, alice2blockchain.ref, alice2relayer.ref, FakeTxPublisherFactory(alice2blockchain)), alicePeer.ref) | ||
|
|
||
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.
Are you sure this actually achieves something? The calling thread will still be blocked right?
Uh oh!
There was an error while loading. Please reload this page.
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.
No it shouldn't, this should be using a spin lock (or something equivalent) and should release the thread after each test (so that other tests can run on that thread between checks), whereas
Thread.sleepblocks the thread for the whole duration for everyone.I haven't actually verified this, but it was the behavior on .NET and the JVM is highly similar, so I expect this to be true.
Uh oh!
There was an error while loading. Please reload this page.
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.
According to the doc of
eventually, it attempts the check then sleeps (I assume withThread.sleep) for the interval duration, then rinse & repeat. So it's not as good as I hoped, but it's still better thanThread.sleep, because instead of blocking the thread for the whole duration, we block it for smaller chunks, which regularly gives the opportunity for the task scheduler to run something else on this thread.Uh oh!
There was an error while loading. Please reload this page.
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.
Yes, but I think this saves thread time for the additional thread that executes whatever code is inside the
eventually. The caller thread still has to wait. Maybe I'm completely wrong.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.
I don't think there is an additional thread that executes the code in the
eventually, I believe that most of the time it will just be executed by the caller thread (especially since it doesn't contain a future)?