Skip to content

Commit 0d33256

Browse files
benthecarmanclaude
andcommitted
Add e2e config startup tests
Test server startup with various config settings: optional fields, log levels, TLS hosts, LSPS2 variations, and bitcoind RPC with localhost hostname. Add negative tests for invalid configs ensuring proper error messages. Dedicated chain source tests verify each backend explicitly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3fc6c7a commit 0d33256

2 files changed

Lines changed: 528 additions & 0 deletions

File tree

e2e-tests/src/lib.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,26 @@ fn spawn_server(
354354
(child, params)
355355
}
356356

357+
/// Start ldk-server with the given config and expect it to fail (exit non-zero).
358+
/// Returns the stderr output for assertion in tests.
359+
pub fn start_expect_failure(
360+
bitcoind: &TestBitcoind, config_fn: impl FnOnce(&TestServerParams) -> String,
361+
) -> String {
362+
let (child, ..) = spawn_server(bitcoind, config_fn);
363+
364+
let output = child
365+
.wait_with_output()
366+
.unwrap_or_else(|e| panic!("Failed to wait for ldk-server process: {}", e));
367+
368+
assert!(
369+
!output.status.success(),
370+
"Expected server to fail but it exited with status: {}",
371+
output.status
372+
);
373+
374+
String::from_utf8_lossy(&output.stderr).to_string()
375+
}
376+
357377
/// Find an available TCP port by binding to port 0.
358378
pub fn find_available_port() -> u16 {
359379
let listener = TcpListener::bind("127.0.0.1:0").unwrap();

0 commit comments

Comments
 (0)