forked from mirrors/gstreamer-rs
log_handler test: Ignore unknown categories
Tests run parallel in multiple threads. This makes the log_handler test flaky because it may see log messages triggered by other threads. Make the handler ignore all messages not in the category we care about.
This commit is contained in:
parent
6488c42890
commit
8db9926107
1 changed files with 7 additions and 1 deletions
|
@ -457,7 +457,13 @@ mod tests {
|
||||||
_object: Option<&glib::Object>,
|
_object: Option<&glib::Object>,
|
||||||
message: &DebugMessage| {
|
message: &DebugMessage| {
|
||||||
let cat = DebugCategory::get("test-cat-log").unwrap();
|
let cat = DebugCategory::get("test-cat-log").unwrap();
|
||||||
assert_eq!(category, cat);
|
|
||||||
|
if category != cat {
|
||||||
|
// This test can run in parallel with other tests, including new_and_log above.
|
||||||
|
// We cannot be certain we only see our own messages.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
assert_eq!(level, DebugLevel::Info);
|
assert_eq!(level, DebugLevel::Info);
|
||||||
assert_eq!(message.get(), Some("meh"));
|
assert_eq!(message.get(), Some("meh"));
|
||||||
let _ = sender.lock().unwrap().send(());
|
let _ = sender.lock().unwrap().send(());
|
||||||
|
|
Loading…
Reference in a new issue