]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
containers test: Wait a few more seconds for the socket to be deleted
authorSimon McVittie <smcv@collabora.com>
Mon, 19 Nov 2018 13:53:52 +0000 (13:53 +0000)
committerSimon McVittie <smcv@collabora.com>
Mon, 19 Nov 2018 13:53:52 +0000 (13:53 +0000)
Previously, we were waiting a few seconds for the dbus-daemon to stop
listening, then trying to connect again and asserting that it failed,
then immediately asserting that the socket had actually been deleted.
However, there is a race here: the dbus-daemon stops listening on the
socket, and then deletes it. If the test client wins the race by
probing to see whether the socket is present after the dbus-daemon
has stopped listening but before the dbus-daemon has deleted it, then
the test will fail.

This intermittently happens on Gitlab-CI, most recently in
<https://gitlab.freedesktop.org/smcv/dbus/-/jobs/45694>.

Signed-off-by: Simon McVittie <smcv@collabora.com>
test/containers.c

index 8989804889af4bf4f5cae2164399d56570368722..dcc81c5ce5738f13e7c9fc952ab530f35bb3f3a5 100644 (file)
@@ -1005,6 +1005,14 @@ test_stop_server (Fixture *f,
   g_clear_error (&f->error);
   g_assert_null (second_confined_conn);
 
+  /* Deleting the socket is not synchronous with respect to stopping
+   * listening on it, so again we are willing to wait a few seconds */
+  for (i = 0; i < 50; i++)
+    {
+      if (g_file_test (f->socket_path, G_FILE_TEST_EXISTS))
+        g_usleep (G_USEC_PER_SEC / 10);
+    }
+
   /* The socket has been deleted */
   g_assert_false (g_file_test (f->socket_path, G_FILE_TEST_EXISTS));