]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
pytests: conn_flood set socket limit to 15k
authorTomas Krizek <tomas.krizek@nic.cz>
Tue, 20 Nov 2018 10:46:00 +0000 (11:46 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 4 Dec 2018 16:13:42 +0000 (17:13 +0100)
tests/pytests/conn_flood.py

index 18d3f83ee10801b978f6bfaaf99c62e7b1872669..1e4da0b5b002bf1bc21f0746b79cd2940ff972bb 100644 (file)
@@ -17,7 +17,6 @@ from kresd import Kresd, make_port
 import utils
 
 
-# TODO: test often fails in CI, debug and maybe decrease MAX_SOCKETS?
 MAX_SOCKETS = 15000  # upper bound of how many connections to open
 MAX_ITERATIONS = 20  # number of iterations to run the test
 
@@ -34,9 +33,7 @@ RESERVED_NOFILE = 40  # 40 is empirical value
 ])
 def test_conn_flood(tmpdir, sock_func_name):
     def create_sockets(make_sock, nsockets):
-        buff, _ = utils.get_msgbuff()
         sockets = []
-
         next_ping = time.time() + 5  # less than tcp idle timeout
         while True:
             while time.time() < next_ping:
@@ -47,9 +44,9 @@ def test_conn_flood(tmpdir, sock_func_name):
 
             # large number of connections can take a lot of time to open
             # send some valid data to avoid TCP idle timeout for already open sockets
-            for s in sockets:
-                s.sendall(buff)
             next_ping = time.time() + 5
+            for s in sockets:
+                utils.ping_alive(s)
 
     max_num_of_open_files = resource.getrlimit(resource.RLIMIT_NOFILE)[0] - RESERVED_NOFILE
     nsockets = min(max_num_of_open_files, MAX_SOCKETS)