-
Notifications
You must be signed in to change notification settings - Fork 404
allow functional tests to be used externally with a dynamic signer factory #3016
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
allow functional tests to be used externally with a dynamic signer factory #3016
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3016 +/- ##
==========================================
- Coverage 88.61% 88.56% -0.06%
==========================================
Files 149 152 +3
Lines 117091 117270 +179
Branches 117091 117270 +179
==========================================
+ Hits 103765 103863 +98
- Misses 10817 10889 +72
- Partials 2509 2518 +9 ☔ View full report in Codecov by Sentry. |
1a142e1
to
4077bc2
Compare
4077bc2
to
3a1986c
Compare
9d4e233
to
f341a0c
Compare
87aadef
to
4efd374
Compare
3c454d0
to
ef8f13d
Compare
fd35254
to
2e2df96
Compare
one more idea. it would be nice to collect all the tests of a file into a static array. this would require one of the following to automatically collect the array:
|
84abf70
to
0a29d64
Compare
6879363
to
dceae89
Compare
f987683
to
dfda072
Compare
Ugh sorry this needs rebase after #3604. Should clean a few things up nicely though. |
0734677
to
fecc6c2
Compare
no problem, rebase done |
6223c18
to
8db5ba6
Compare
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.
Okay, one last comment now that its been rebased, then I'm happy to land this 🎉
8db5ba6
to
120270c
Compare
We want to allow functional tests to be run by other project, allowing them to replace components, such as the signer.
Can be used for specifying dynamic components for tests, such as the signer.
120270c
to
bec117a
Compare
DynSigner provides an abstraction for specifying an external signer for functional tests.
Also, introduce TestSignerFactory, a factory for dynamic signers and ext-functional-test-demo crate for testing this machinery.
bec117a
to
9d8a91a
Compare
fixed rustfmt nit |
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.
Gonna go ahead and land this, but there's a few things we'll need to clean up in a followup.
@@ -4670,6 +4673,7 @@ where | |||
/// | |||
/// LDK will not automatically retry this payment, though it may be manually re-sent after an | |||
/// [`Event::PaymentFailed`] is generated. | |||
#[cfg(any(test, feature = "_test_utils"))] |
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.
Looks like this wasn't removed.
@@ -515,8 +513,7 @@ impl<'a, 'b, 'c> Node<'a, 'b, 'c> { | |||
/// Toggles this node's signer to be available for the given signer operation. | |||
/// This is useful for testing behavior for restoring an async signer that previously | |||
/// could not return a signature immediately. | |||
#[cfg(test)] | |||
pub fn enable_channel_signer_op(&self, peer_id: &PublicKey, chan_id: &ChannelId, signer_op: SignerOp) { | |||
pub fn enable_channel_signer_op(&self, peer_id: &PublicKey, chan_id: &ChannelId, signer_op: SignerOp) { |
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.
Here and the next method down have indentation issues now.
error_code, | ||
#[cfg(test)] | ||
error_data, .. } => { | ||
error_code, |
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.
Oops, weird indentation here too.
@@ -2897,7 +2898,7 @@ fn claim_htlc_outputs() { | |||
// transaction. | |||
// | |||
// This is a regression test for https://github.com/lightningdevkit/rust-lightning/issues/3537. | |||
#[test] | |||
#[xtest(feature = "_externalize_tests")] | |||
fn test_multiple_package_conflicts() { |
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.
Missing pub here
@@ -5046,7 +5047,7 @@ fn test_static_spendable_outputs_timeout_tx() { | |||
check_spends!(spend_txn[2], node_txn[0], commitment_tx[0]); // All outputs | |||
} | |||
|
|||
fn do_test_static_spendable_outputs_justice_tx_revoked_commitment_tx(split_tx: bool) { | |||
pub fn do_test_static_spendable_outputs_justice_tx_revoked_commitment_tx(split_tx: bool) { |
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.
Doesn't need to be pub here.
do_test_max_dust_htlc_exposure_by_threshold_type(false, false); | ||
do_test_max_dust_htlc_exposure_by_threshold_type(false, true); | ||
do_test_max_dust_htlc_exposure_by_threshold_type(true, false); | ||
do_test_max_dust_htlc_exposure_by_threshold_type(true, true); | ||
} | ||
|
||
#[test] | ||
#[xtest(feature = "_externalize_tests")] | ||
fn test_nondust_htlc_excess_fees_are_dust() { |
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.
Missing pub
@@ -11941,7 +11942,7 @@ fn test_manual_funding_abandon() { | |||
})); | |||
} | |||
|
|||
#[test] | |||
#[xtest(feature = "_externalize_tests")] | |||
fn test_funding_signed_event() { |
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.
Missing pub
DynSigner
xtest
macrosfake_network_test
and others