Skip to content

Commit fd9793b

Browse files
committed
Make lightning-background-processor test failures more debugable
Instead of asserting a `Result` `is_ok`, we should always simply `unwrap` to get a backgrace, and we should avoid doing so if the thread is already panicking.
1 parent 3b8bf93 commit fd9793b

File tree

1 file changed

+12
-4
lines changed
  • lightning-background-processor/src

1 file changed

+12
-4
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,9 @@ mod tests {
12081208
}
12091209
}
12101210

1211-
assert!(bg_processor.stop().is_ok());
1211+
if !std::thread::panicking() {
1212+
bg_processor.stop().unwrap();
1213+
}
12121214
}
12131215

12141216
#[test]
@@ -1326,7 +1328,9 @@ mod tests {
13261328
_ => panic!("Unexpected event: {:?}", event),
13271329
}
13281330

1329-
assert!(bg_processor.stop().is_ok());
1331+
if !std::thread::panicking() {
1332+
bg_processor.stop().unwrap();
1333+
}
13301334
}
13311335

13321336
#[test]
@@ -1345,7 +1349,9 @@ mod tests {
13451349
}
13461350
}
13471351

1348-
assert!(bg_processor.stop().is_ok());
1352+
if !std::thread::panicking() {
1353+
bg_processor.stop().unwrap();
1354+
}
13491355
}
13501356

13511357
#[test]
@@ -1519,6 +1525,8 @@ mod tests {
15191525
_ => panic!("Unexpected event"),
15201526
}
15211527

1522-
assert!(bg_processor.stop().is_ok());
1528+
if !std::thread::panicking() {
1529+
bg_processor.stop().unwrap();
1530+
}
15231531
}
15241532
}

0 commit comments

Comments
 (0)