Add e2e config startup tests#142
Conversation
|
👋 Thanks for assigning @joostjager as a reviewer! |
aa4e94a to
8a9bf3a
Compare
|
🔔 1st Reminder Hey @jkczyz! This PR has been waiting for your review. |
|
🔔 2nd Reminder Hey @jkczyz! This PR has been waiting for your review. |
|
🔔 3rd Reminder Hey @jkczyz! This PR has been waiting for your review. |
|
🔔 4th Reminder Hey @jkczyz! This PR has been waiting for your review. |
1859bb4 to
957057f
Compare
|
🔔 5th Reminder Hey @jkczyz! This PR has been waiting for your review. |
957057f to
0db68fb
Compare
| std::fs::write(&config_path, &config_content).unwrap(); | ||
| impl LdkServerHandle { | ||
| /// Starts a new ldk-server instance against the given bitcoind. | ||
| /// Randomly picks between bitcoind RPC, electrum, and esplora as the chain source. |
There was a problem hiding this comment.
I really don't think we should be doing this to increase test coverage. Rather see a nightly job that runs a more extensive test suite.
There was a problem hiding this comment.
For this in particular was just trying to copy what ldk-node does
There was a problem hiding this comment.
Imo it is an anti-pattern that emerged in ldk and ldk-node too indeed.
There was a problem hiding this comment.
seems dropped from this pr now, so no discussion point anymore
|
🔔 6th Reminder Hey @jkczyz! This PR has been waiting for your review. |
143c748 to
0d33256
Compare
|
🔔 7th Reminder Hey @jkczyz! This PR has been waiting for your review. |
|
🔔 8th Reminder Hey @jkczyz! This PR has been waiting for your review. |
|
🔔 9th Reminder Hey @jkczyz! This PR has been waiting for your review. |
69b3d64 to
81f6bf3
Compare
|
🔔 10th Reminder Hey @jkczyz! This PR has been waiting for your review. |
|
🔔 11th Reminder Hey @jkczyz! This PR has been waiting for your review. |
|
🔔 12th Reminder Hey @jkczyz! This PR has been waiting for your review. |
|
🔔 13th Reminder Hey @jkczyz! This PR has been waiting for your review. |
|
🔔 14th Reminder Hey @jkczyz! This PR has been waiting for your review. |
|
🔔 15th Reminder Hey @jkczyz! This PR has been waiting for your review. |
|
Thanks for this. Building this branch with |
81f6bf3 to
b5fd87b
Compare
|
Cleaned up to be a lot simpler than previous iteration |
joostjager
left a comment
There was a problem hiding this comment.
E2E tests seem to be pretty heavy for config validation. Can't that be done just as well on the unit test level?
Perhaps a smoke test is useful that tests one invalid config, see how that traverses the full stack.
Resolve the e2e harness conflicts around gRPC config startup and add coverage for supported configuration variants and startup failures. AI-assisted-by: OpenAI Codex
b5fd87b to
3d8273e
Compare
Yeah we already have config unit tests, the goal of these is to make it so we test things that our config can't really validate and also make sure we are properly handling a valid config. Removed some of the tests that were basically recreations of the config unit tests and added more that actually target where we could and should throw errors. |
joostjager
left a comment
There was a problem hiding this comment.
The latest shape is better after trimming config tests.
I do still get a slight feeling of overlap with ldk-node coverage. Going forward, I think we should be pretty strict about keeping that duplication to a minimum. Just test the things in ldk-server that also mainly live there.
Left a few non-blocking remarks.
| }) | ||
| .await; | ||
| let info = server.client().get_node_info(GetNodeInfoRequest {}).await.unwrap(); | ||
| assert!(info.current_best_block.is_some()); |
There was a problem hiding this comment.
Here and above, perhaps assert a bit more, in particular the addresses?
These tests do look quite similar to what's already in ldk-node, IIRC. Not sure if it adds much.
| pub async fn start_with_options(bitcoind: &TestBitcoind, config: LdkServerConfig) -> Self { | ||
| Self::start_with_config(bitcoind, |params| { | ||
| let chain_source = format!( | ||
| "[bitcoind]\nrpc_address = \"{}\"\nrpc_user = \"{}\"\nrpc_password = \"{}\"", |
There was a problem hiding this comment.
This is duplicated in a few places, perhaps it can be a helper.
| config.lines().filter(|line| !line.trim_start().starts_with(key)).collect::<Vec<_>>().join("\n") | ||
| } | ||
|
|
||
| fn replace_config_line(config: &str, key: &str, new_line: &str) -> String { |
There was a problem hiding this comment.
I am not sure about this mix of having a config builder, but then also surgically modifying it again. Might be a bit brittle too. Any way to make this more consistent/robust?
Continuation of #128 / #113
Add config test suite that verifies server startup with various config combinations (to prevent things like #129) and validates errors for invalid configs.