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.
This commit is contained in:
Jeffrey Czyz 2021-07-18 12:59:27 -05:00
parent 1f1d7c6890
commit d9fa8f1c38
No known key found for this signature in database
GPG key ID: 3A4E08275D5E96D2

View file

@ -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]