Skip to content

Add test coverage of async BP and fix minor bug #2145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions lightning-background-processor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,9 @@ mod tests {
let filepath = get_full_filepath("test_background_processor_persister_0".to_string(), "scorer".to_string());
check_persisted_data!(nodes[0].scorer, filepath.clone());

assert!(bg_processor.stop().is_ok());
if !std::thread::panicking() {
bg_processor.stop().unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking nit: Since we're touching them, all of these could also be expect.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it matters? Its a test and I think the expectation here is clear, we don't really need to document why we shouldnt get an error?

}
}

#[test]
Expand All @@ -1208,7 +1210,9 @@ mod tests {
}
}

assert!(bg_processor.stop().is_ok());
if !std::thread::panicking() {
bg_processor.stop().unwrap();
}
}

#[test]
Expand Down Expand Up @@ -1300,7 +1304,9 @@ mod tests {
nodes[1].node.handle_channel_ready(&nodes[0].node.get_our_node_id(), &as_funding);
let _bs_channel_update = get_event_msg!(nodes[1], MessageSendEvent::SendChannelUpdate, nodes[0].node.get_our_node_id());

assert!(bg_processor.stop().is_ok());
if !std::thread::panicking() {
bg_processor.stop().unwrap();
}

// Set up a background event handler for SpendableOutputs events.
let (sender, receiver) = std::sync::mpsc::sync_channel(1);
Expand All @@ -1326,7 +1332,9 @@ mod tests {
_ => panic!("Unexpected event: {:?}", event),
}

assert!(bg_processor.stop().is_ok());
if !std::thread::panicking() {
bg_processor.stop().unwrap();
}
}

#[test]
Expand All @@ -1345,7 +1353,9 @@ mod tests {
}
}

assert!(bg_processor.stop().is_ok());
if !std::thread::panicking() {
bg_processor.stop().unwrap();
}
}

#[test]
Expand Down Expand Up @@ -1519,6 +1529,8 @@ mod tests {
_ => panic!("Unexpected event"),
}

assert!(bg_processor.stop().is_ok());
if !std::thread::panicking() {
bg_processor.stop().unwrap();
}
}
}