]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
tests/net: add small sleep to ensure the server socket is really closed
authorDaniel Salzman <daniel.salzman@nic.cz>
Thu, 4 Aug 2022 10:54:13 +0000 (12:54 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Tue, 13 Sep 2022 05:22:32 +0000 (07:22 +0200)
fixes #806

tests/contrib/test_net.c

index 0a22abbbc48e1a5810c8373839c98348c963a56b..1b5634fefd551166d8480b52092b794ddce62848 100644 (file)
@@ -1,4 +1,4 @@
-/*  Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/*  Copyright (C) 2022 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@
 #include <signal.h>
 #include <stdbool.h>
 #include <string.h>
+#include <unistd.h>
 
 #include "libknot/errcode.h"
 #include "contrib/net.h"
@@ -383,6 +384,7 @@ static void test_refused(void)
 
        r = close(server);
        is_int(0, r, "server, close socket");
+       usleep(50000);
 
        r = net_stream_send(client, (uint8_t *)"", 1, TIMEOUT);
        is_int(KNOT_ECONN, r, "client, refused on write");