flatpak-github-actions icon indicating copy to clipboard operation
flatpak-github-actions copied to clipboard

Testing dbus services / clients

Open tchx84 opened this issue 4 years ago • 3 comments

I am probably missing something important but I can't seem to test dbus services and/or clients:

GLib.Error g-spawn-exit-error-quark: Error spawning command line “dbus-launch --autolaunch=180049aac266486c89ec8c79e659685e --binary-syntax --close-stderr”: Child process exited with code 1 thrown in resource:///org/gnome/gjs/modules/core/overrides/Gio.js (line 457)
    get session@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:457:24

It seems that is not possible to spawn/launch services from within flatpak-builder. I tried to reproduce the dbus-launch command and got this:

[📦 org.gnome.Sdk project]# dbus-launch --autolaunch=180049aac266486c89ec8c79e659685e --
Autolaunch requested, but X11 support not compiled in.
Cannot continue.

I also tried adding more permissions to test-args (e.g. --socket=session-bus, --filesystem=host, etc) , but didn't make any difference.

Any ideas?

tchx84 avatar Mar 07 '21 13:03 tchx84

It's even possible to launch a dbus session inside a Docker container? :thinking:

nyx-lyb3ra avatar Mar 13 '21 18:03 nyx-lyb3ra

It should be possible if we run dbus-run-session before running the build, as we can't influence the test stage (it's run by flatpak). See https://gitlab.gnome.org/GNOME/citemplates/-/blob/master/flatpak/flatpak_ci_initiative.yml#L23-25 for the stuff we are currently missing.

bilelmoussaoui avatar Apr 16 '21 02:04 bilelmoussaoui

I've started taking a crack at this one, since it would be cool to be able to run D-Bus tests. I've really just prepended dbus-run-session to the command-line here, but without much luck. If anyone has any tips about how these pieces fit together I'd be happy to hear them :)

I've been able to confirm dbus-run-session is the parent process, as the error(s) now read...

Build failed: Error: The process '/usr/bin/dbus-run-session' failed with exit code 1

instead of...

Build failed: Error: The process '/usr/bin/xvfb-run' failed with exit code 1

As an interesting side-note, some of my D-Bus tests are wrapped in a python-dbusmock script and those work fine. That may be a usable workaround for the time being, but I'll be avoiding it personally.

andyholmes avatar Jun 20 '22 03:06 andyholmes