-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expose functional tests under _test_utils feature flag
introduce DynSigner and TestSignerFactory
- Loading branch information
Showing
32 changed files
with
1,142 additions
and
523 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "ext-functional-tester" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
lightning = { path = "../lightning", features = ["_test_utils"] } |
This file contains 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use lightning::util::dyn_signer::{DynKeysInterfaceTrait, DynSigner}; | ||
use lightning::util::test_utils::{TestSignerFactory, SIGNER_FACTORY}; | ||
use std::panic::catch_unwind; | ||
use std::sync::Arc; | ||
use std::time::Duration; | ||
|
||
struct BrokenSignerFactory(); | ||
|
||
impl TestSignerFactory for BrokenSignerFactory { | ||
fn make_signer( | ||
&self, _seed: &[u8; 32], _now: Duration, | ||
) -> Box<dyn DynKeysInterfaceTrait<EcdsaSigner = DynSigner>> { | ||
panic!() | ||
} | ||
} | ||
|
||
#[test] | ||
fn test_functional() { | ||
lightning::ln::functional_tests::test_insane_channel_opens(); | ||
lightning::ln::functional_tests::fake_network_test(); | ||
|
||
SIGNER_FACTORY.set(Arc::new(BrokenSignerFactory())); | ||
catch_unwind(|| lightning::ln::functional_tests::fake_network_test()).unwrap_err(); | ||
} | ||
} |
This file contains 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 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 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 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 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 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 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 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 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 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.