summaryrefslogtreecommitdiff
path: root/test/containers.c
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2018-11-19 13:53:52 +0000
committerSimon McVittie <smcv@collabora.com>2018-11-19 13:53:52 +0000
commitc2ee90375a922c165c71a3ef5de35727b16d5844 (patch)
treea9e6598691f8cb510ad881d19602c03a8ef685d5 /test/containers.c
parentc018e0b1b28107cac6d243295b7afa8939fdbdcd (diff)
downloaddbus-c2ee90375a922c165c71a3ef5de35727b16d5844.tar.gz
containers test: Wait a few more seconds for the socket to be deleted
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>
Diffstat (limited to 'test/containers.c')
-rw-r--r--test/containers.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/containers.c b/test/containers.c
index 89898048..dcc81c5c 100644
--- a/test/containers.c
+++ b/test/containers.c
@@ -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));