glib/gio/tests/services
Philip Withnall d7e368f206
tests: Move fake-document-portal subprocess inside dbus-appinfo test
For the reasons given in
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4176#note_2233317,
it’s best to not rely on subprocesses when writing tests. Spawning a
subprocess can go wrong, getting feedback and assertion data from a
subprocess is a pain, and making sure the subprocess is killed properly
at the end of the test is hard to get right.

For tests where we are trying to mock a D-Bus service, it’s much more
reliable to run that service in-process (either in the main thread or in
a separate thread).

So, do that for the `fake-document-portal` former subprocess in the
`dbus-appinfo` test: move it to a worker thread.

This speeds the test up, simplifies the build slightly, and should make
the test run more reliable.

In particular, it provides a pattern for future `fake-*-portal` tests to
be built off. This is particularly useful for more complex portals,
where data needs to be relayed back from the mock portal service to the
unit test to check that the code under test has behaved properly. That’s
a pain to do from a subprocess.

Delete the `org.freedesktop.portal.Documents.service` file because we no
longer need to rely on D-Bus service activation within the test, as
we’re setting up the mock service thread explicitly now.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-10-01 15:22:40 +01:00
..
meson.build tests: Move fake-document-portal subprocess inside dbus-appinfo test 2024-10-01 15:22:40 +01:00
org.gtk.GDBus.Examples.ObjectManager.service.in Adding test coverage for GTestDBus activating in-tree services. 2012-12-28 21:28:28 -05:00
org.gtk.GDBus.FakeService.service.in Extend dbus watching name tests: 2021-01-25 15:00:12 +01:00