Commit c2ee9037 authored by Simon McVittie's avatar Simon McVittie

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's avatarSimon McVittie <smcv@collabora.com>
parent c018e0b1
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment