From: Jeffrey Czyz Date: Sun, 18 Jul 2021 17:59:27 +0000 (-0500) Subject: Correctly assert BackgroundProcessor error X-Git-Tag: v0.0.100~18^2~2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=d9fa8f1c3872a32d107ac2e5630d6c3922bf9cc9;p=rust-lightning Correctly assert BackgroundProcessor error The specific error from the ChannelManager persister is not asserted for in test_persist_error. Rather, any error will do. Update the test to use BackgroundProcessor::stop and assert for the expected value. --- diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs index 0b886f7bf..f5c914ed5 100644 --- a/lightning-background-processor/src/lib.rs +++ b/lightning-background-processor/src/lib.rs @@ -416,7 +416,13 @@ mod tests { let persister = |_: &_| Err(std::io::Error::new(std::io::ErrorKind::Other, "test")); let event_handler = |_| {}; let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].peer_manager.clone(), nodes[0].logger.clone()); - let _ = bg_processor.thread_handle.join().unwrap().expect_err("Errored persisting manager: test"); + match bg_processor.stop() { + Ok(_) => panic!("Expected error persisting manager"), + Err(e) => { + assert_eq!(e.kind(), std::io::ErrorKind::Other); + assert_eq!(e.get_ref().unwrap().to_string(), "test"); + }, + } } #[test]