Commit 936994b3 authored by Rafael Monnerat's avatar Rafael Monnerat

Implement initial timeout to never lock a test run for more them a day

parent ea890a3a
......@@ -29,7 +29,7 @@
import os
import transaction
from time import sleep
import time
import signal
import re
from subprocess import Popen, PIPE
......@@ -63,6 +63,9 @@ bt5_dir_list = ','.join([
os.path.join(instance_home, 'Products/ERP5/bootstrap'),
os.path.join(instance_home, 'bt5')])
class TimeoutError(Exception):
pass
class Xvfb:
def __init__(self, fbdir, display):
self.display = display
......@@ -201,6 +204,8 @@ user_pref("capability.principal.codebase.p1.subjectName", "");""" % \
class FunctionalTestRunner:
# There is no test that can take more them 24 hours
timeout = 24 * 60 * 60
def __init__(self, host, port, portal, run_only=''):
......@@ -232,12 +237,15 @@ class FunctionalTestRunner:
display = None
xvfb = Xvfb(self.instance_home, None)
try:
start = time.time()
if not debug and self.browser.use_xvfb:
xvfb.display = self.xvfb_display
xvfb.run()
browser.run(test_url, xvfb.display)
while self.getStatus() is None:
sleep(10)
time.sleep(10)
if (start - time.time()) > float(self.timeout):
raise TimeoutError("Test took more them %s seconds" % self.timeout)
finally:
browser.quit()
......
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