Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Don't panic in Offchain test context, when we are already panicking #3996

Merged
merged 1 commit into from
Nov 1, 2019
Merged
Changes from all commits
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
3 changes: 2 additions & 1 deletion core/offchain/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ impl State {

impl Drop for State {
fn drop(&mut self) {
if !self.expected_requests.is_empty() {
// If we panic! while we are already in a panic, the test dies with an illegal instruction.
if !self.expected_requests.is_empty() && !std::thread::panicking() {
panic!("Unfulfilled expected requests: {:?}", self.expected_requests);
}
}
Expand Down