From: Simon McVittie Date: Mon, 19 Nov 2018 13:53:52 +0000 (+0000) Subject: containers test: Wait a few more seconds for the socket to be deleted X-Git-Tag: dbus-1.13.8~26^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c2ee90375a922c165c71a3ef5de35727b16d5844;p=thirdparty%2Fdbus.git 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 . Signed-off-by: Simon McVittie --- diff --git a/test/containers.c b/test/containers.c index 898980488..dcc81c5ce 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));