diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-01-14 22:27:40 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-01-14 22:27:40 +0000 |
| commit | c6fcfa509ee4df41ab30f8cdc1daa88f39b33c86 (patch) | |
| tree | b7a2ddfd98ee3cdfee5bfdf0cdd4e1fa45273eb2 /nova/tests | |
| parent | b097b59c375c853170954724bbc6bdfff24e08ea (diff) | |
| parent | d0c5fe6be4d6b00c5947f4b2a37ca9f496941e8b (diff) | |
Merge "Fix logic error in periodic task wait code."
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/test_periodic_tasks.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/nova/tests/test_periodic_tasks.py b/nova/tests/test_periodic_tasks.py index 5804ea49b..39669967f 100644 --- a/nova/tests/test_periodic_tasks.py +++ b/nova/tests/test_periodic_tasks.py @@ -17,6 +17,7 @@ import fixtures +import time from nova import manager from nova import test @@ -76,6 +77,19 @@ class Manager(test.TestCase): idle = m.periodic_tasks(None) self.assertAlmostEqual(60, idle, 1) + def test_periodic_tasks_idle_calculation(self): + class Manager(manager.Manager): + @manager.periodic_task(spacing=10) + def bar(self): + return 'bar' + + m = Manager() + m.periodic_tasks(None) + time.sleep(0.1) + idle = m.periodic_tasks(None) + self.assertTrue(idle > 9.7) + self.assertTrue(idle < 9.9) + def test_periodic_tasks_disabled(self): class Manager(manager.Manager): @manager.periodic_task(spacing=-1) |
