nix: test dbus via notify-send
All checks were successful
Tests / Go tests (push) Successful in 1m28s
Nix / NixOS tests (push) Successful in 4m0s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
Ophestra 2024-12-22 11:31:12 +09:00
parent e8594cf670
commit 5838963265
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q

View File

@ -38,6 +38,10 @@ nixosTest {
wayland-utils wayland-utils
alacritty alacritty
# For D-Bus tests:
libnotify
mako
# For go tests: # For go tests:
self.devShells.${system}.fhs self.devShells.${system}.fhs
]; ];
@ -176,6 +180,10 @@ nixosTest {
if instance['config']['confinement']['enablements'] != enablements: if instance['config']['confinement']['enablements'] != enablements:
raise Exception(f"unexpected enablements {instance['config']['confinement']['enablements']}") raise Exception(f"unexpected enablements {instance['config']['confinement']['enablements']}")
def fortify(command):
swaymsg(f"exec fortify {command}")
start_all() start_all()
machine.wait_for_unit("multi-user.target") machine.wait_for_unit("multi-user.target")
@ -198,8 +206,10 @@ nixosTest {
machine.wait_for_file("/tmp/fortify.1000/tmpdir/0/success-bare") machine.wait_for_file("/tmp/fortify.1000/tmpdir/0/success-bare")
# Start fortify within Wayland session: # Start fortify within Wayland session:
swaymsg("exec fortify -v run --wayland --dbus touch /tmp/success-session") fortify('-v run --wayland --dbus notify-send -a "NixOS Tests" "Test notification" "Notification from within sandbox." && touch /tmp/dbus-done')
machine.wait_for_file("/tmp/fortify.1000/tmpdir/0/success-session") machine.wait_for_file("/tmp/dbus-done")
collect_state_ui("dbus_notify_exited")
machine.succeed("pkill -9 mako")
# Start a terminal (foot) within fortify: # Start a terminal (foot) within fortify:
swaymsg("exec fortify run --wayland foot") swaymsg("exec fortify run --wayland foot")