Merge lp:~soren/nova/skip-timing-sensitive-tests into lp:~hudson-openstack/nova/trunk

Proposed by Soren Hansen
Status: Rejected
Rejected by: Soren Hansen
Proposed branch: lp:~soren/nova/skip-timing-sensitive-tests
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 22 lines (+6/-0)
1 file modified
nova/tests/api/openstack/test_ratelimiting.py (+6/-0)
To merge this branch: bzr merge lp:~soren/nova/skip-timing-sensitive-tests
Reviewer Review Type Date Requested Status
Nova Core security contacts Pending
Review via email: mp+53603@code.launchpad.net

Commit message

Skip timing sensitive tests if SKIP_TIMING_SENSITIVE_TESTS is set.

To post a comment you must log in.
Revision history for this message
Brian Lamar (blamar) wrote :

I've fixed ratelimiting in general to not unit test using `time.sleep` anymore. IMO testing with `time.sleep` is a hack and I'd rather see it go away than have this go in. :)

I'll not 'Disapprove' because it would be a bias review based on my branch, but feel free to look over my Limits reworking which improves testability and ensures tests are MUCH faster due to no more sleeps. :)

https://code.launchpad.net/~blamar/nova/lp728587/+merge/53554

Revision history for this message
Soren Hansen (soren) wrote :

Avoiding sleeps altogether sounds like a massive win. Let's go with that instead.

Unmerged revisions

802. By Soren Hansen

Make timing sensitive test (specifically nova.tests.api.openstack.test_ratelimiting:LimiterTest.test_second) be skipped if SKIP_TIMING_SENSITIVE_TESTS environment is set.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'nova/tests/api/openstack/test_ratelimiting.py'
--- nova/tests/api/openstack/test_ratelimiting.py 2011-02-23 19:56:37 +0000
+++ nova/tests/api/openstack/test_ratelimiting.py 2011-03-16 11:02:54 +0000
@@ -1,5 +1,6 @@
1import httplib1import httplib
2import StringIO2import StringIO
3import os
3import time4import time
4import webob5import webob
56
@@ -31,6 +32,11 @@
31 self.assertAlmostEqual(when, delay, 2)32 self.assertAlmostEqual(when, delay, 2)
3233
33 def test_second(self):34 def test_second(self):
35 skip_test_env = os.environ.get('SKIP_TIMING_SENSITIVE_TESTS', False)
36 if skip_test_env:
37 if not (skip_test_env == '0' or skip_test_env == 'no'):
38 return
39
34 self.exhaust('a', 5)40 self.exhaust('a', 5)
35 time.sleep(0.2)41 time.sleep(0.2)
36 self.exhaust('a', 1)42 self.exhaust('a', 1)