Decrease time.sleep times in tests to save 60 seconds for test-suite run.

This commit is contained in:
Jan Kaluza
2018-02-08 09:03:32 +01:00
parent bc3412683a
commit 683056de0a
3 changed files with 9 additions and 6 deletions

View File

@@ -109,8 +109,8 @@ class TestConfiguration(BaseConfiguration):
NET_TIMEOUT = 3
NET_RETRY_INTERVAL = 1
# SCM network-related values, in seconds
SCM_NET_TIMEOUT = 3
SCM_NET_RETRY_INTERVAL = 1
SCM_NET_TIMEOUT = 0.1
SCM_NET_RETRY_INTERVAL = 0.1
KOJI_CONFIG = './conf/koji.conf'
KOJI_PROFILE = 'staging'

View File

@@ -136,8 +136,11 @@ def init(config, session, msg):
""" Called whenever a module enters the 'init' state."""
# Sleep for a few seconds to make sure the module in the database is committed
# TODO: Remove this once messaging is implemented in SQLAlchemy hooks
time.sleep(3)
build = models.ModuleBuild.from_module_event(session, msg)
for i in range(3):
build = models.ModuleBuild.from_module_event(session, msg)
if build:
break
time.sleep(1)
try:
mmd = build.mmd()

View File

@@ -62,14 +62,14 @@ def retry(timeout=conf.net_timeout, interval=conf.net_retry_interval, wait_on=Ex
def inner(*args, **kwargs):
start = time.time()
while True:
if (time.time() - start) >= timeout:
raise # This re-raises the last exception.
try:
return function(*args, **kwargs)
except wait_on as e:
log.warn("Exception %r raised from %r. Retry in %rs" % (
e, function, interval))
time.sleep(interval)
if (time.time() - start) >= timeout:
raise # This re-raises the last exception.
return inner
return wrapper