Commit acc6a3ab authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[trac420] Try not to timeout on slow machines

Some of our built machines time out, for two possible reasons:
* They have long buffer before they start blocking. Therefore the amount
  of data sent is increased.
* They have clock with low precision, so if now - last_sent > 0.1:
  happens after a long time. So the timeout waiting for that was
  increased.
parent 748885cd
......@@ -117,7 +117,7 @@ class SendNonblock(unittest.TestCase):
Tests that the whole thing will not get blocked if someone does not read.
"""
def terminate_check(self, task, timeout = 1):
def terminate_check(self, task, timeout = 10):
"""
Runs task in separate process (task is a function) and checks
it terminates sooner than timeout.
......@@ -161,16 +161,22 @@ class SendNonblock(unittest.TestCase):
Tries sending messages (and not reading them) until it either times
out (in blocking call, wrong) or closes it (correct).
"""
data = "data"
for i in range(1, 10):
data += data
self.terminate_check(lambda: self.infinite_sender(
lambda msgq, socket: msgq.sendmsg(socket, {}, {"message" : "x"})))
lambda msgq, socket: msgq.sendmsg(socket, {}, {"message" : data})))
def test_infinite_sendprepared(self):
"""
Tries sending data (and not reading them) until it either times
out (in blocking call, wrong) or closes it (correct).
"""
data = b"data"
for i in range(1, 10):
data += data
self.terminate_check(lambda: self.infinite_sender(
lambda msgq, socket: msgq.send_prepared_msg(socket, b"data")))
lambda msgq, socket: msgq.send_prepared_msg(socket, data)))
def send_many(self, data):
"""
......@@ -189,7 +195,7 @@ class SendNonblock(unittest.TestCase):
length = len(data)
queue_pid = os.fork()
if queue_pid == 0:
signal.alarm(10)
signal.alarm(30)
msgq.register_socket(queue)
msgq.run()
else:
......
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