From: Timo Sirainen Date: Thu, 10 Dec 2020 08:44:42 +0000 (+0200) Subject: lib-http: test-http-client-errors - Don't rely on sleeps X-Git-Tag: 2.3.17~398 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e4ab282d56633ce6f8fcac38278ecf5824903ca6;p=thirdparty%2Fdovecot%2Fcore.git lib-http: test-http-client-errors - Don't rely on sleeps Use the notification signal API instead. Also it's only one test (group) that needs to do this. --- diff --git a/src/lib-http/test-http-client-errors.c b/src/lib-http/test-http-client-errors.c index 462c9c45e7..9cb2401d32 100644 --- a/src/lib-http/test-http-client-errors.c +++ b/src/lib-http/test-http-client-errors.c @@ -376,6 +376,8 @@ static void test_server_connection_refused(unsigned int index ATTR_UNUSED) { i_close_fd(&fd_listen); + + test_subprocess_notify_signal_send_parent(); } /* client */ @@ -415,6 +417,9 @@ test_client_connection_refused(const struct http_client_settings *client_set) struct http_client_request *hreq; struct _connection_refused *ctx; + /* wait for the server side to close the socket */ + test_subprocess_notify_signal_wait(10000); + ctx = i_new(struct _connection_refused, 1); ctx->count = 2; @@ -3816,8 +3821,6 @@ test_run_client(const struct http_client_settings *client_set, if (debug) i_debug("PID=%s", my_pid); - i_sleep_msecs(100); /* wait a little for server setup */ - ioloop = io_loop_create(); test_client_run(client_test, client_set); io_loop_destroy(&ioloop); @@ -3835,6 +3838,7 @@ test_run_client_server(const struct http_client_settings *client_set, { unsigned int i; + test_subprocess_notify_signal_reset(); test_server_init = NULL; test_server_deinit = NULL; test_server_input = NULL;