voelin-platform: don't show a test notification on a developer's desktop
notify_returns checks that a notification fails cleanly without a notification service, but where a session bus and a notification daemon exist it sent a real urgent "Poke: from a test" notification on every test run. Skip it there, as the portal capture test already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
81eca6236f
commit
a6016aaf8f
1 file changed
+8
@@ -66,8 +66,16 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
/// Without a notification service this must fail, not hang or panic.
|
/// Without a notification service this must fail, not hang or panic.
|
||||||
|
/// Skipped where a session bus exists: on a desktop the notification
|
||||||
|
/// would really show.
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn notify_returns() {
|
async fn notify_returns() {
|
||||||
|
let runtime_bus = std::env::var_os("XDG_RUNTIME_DIR")
|
||||||
|
.is_some_and(|d| std::path::Path::new(&d).join("bus").exists());
|
||||||
|
if std::env::var_os("DBUS_SESSION_BUS_ADDRESS").is_some() || runtime_bus {
|
||||||
|
eprintln!("skipped: a D-Bus session bus is configured");
|
||||||
|
return;
|
||||||
|
}
|
||||||
let n = Notification { urgent: true, ..Notification::new("Poke", "from a test") };
|
let n = Notification { urgent: true, ..Notification::new("Poke", "from a test") };
|
||||||
let result = tokio::time::timeout(Duration::from_secs(10), notify(&n)).await;
|
let result = tokio::time::timeout(Duration::from_secs(10), notify(&n)).await;
|
||||||
assert!(result.is_ok(), "notify hung");
|
assert!(result.is_ok(), "notify hung");
|
||||||
|
|||||||
Reference in new issue
Block a user