Red Hat Bugzilla – Bug 1294653
(v0.5) ovirtlago assertion check should sleep between retries
Last modified: 2016-01-21 05:52:10 EST
Description of problem:
Currently the code @ ovirtlago/testlib.py is:
143 def assert_true_within(func, timeout):
144 with utils.EggTimer(timeout) as timer:
145 while not timer.elapsed():
147 if func():
149 except Exception:
151 raise AssertionError('Timed out')
Specifically, there is a tight loop there, which consumes CPU needlessly - occupying both the client and the target of func() (for example, checking something on the engine).
23 import time
144 def assert_true_within(func, timeout):
145 with utils.EggTimer(timeout) as timer:
146 while not timer.elapsed():
148 if func():
151 except Exception:
153 raise AssertionError('Timed out')
solves this, by adding a 1 sec. sleep between retries (practically, can even extend to 3 or 5 seconds).
Version-Release number of selected component (if applicable):
https://gerrit.ovirt.org/#/c/51568/ implements this little change.