tests: Wait for LMM server to be available when starting test

Otherwise the test can go on to wait for a signal from the service
before it’s actually finished starting up.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #2887
This commit is contained in:
Philip Withnall 2024-01-22 13:59:12 +00:00
parent 1f2d9e69c9
commit e0276a3a17

View File

@ -57,6 +57,14 @@ try:
fcntl.fcntl(self.p_mock.stdout, fcntl.F_SETFL, flags | os.O_NONBLOCK)
self.last_warning = -1
self.dbusmock = dbus.Interface(self.obj_lmm, dbusmock.MOCK_IFACE)
try:
self.wait_for_bus_object('org.freedesktop.LowMemoryMonitor',
'/org/freedesktop/LowMemoryMonitor',
system_bus=True)
except:
raise
self.memory_monitor = Gio.MemoryMonitor.dup_default()
assert("GMemoryMonitorDBus" in str(self.memory_monitor))
self.memory_monitor.connect("low-memory-warning", self.memory_warning_cb)