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

Proposed by Soren Hansen on 2011-03-16
Status: Rejected
Rejected by: Soren Hansen on 2011-03-17
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 2011-03-16 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.
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

Soren Hansen (soren) wrote :

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

Unmerged revisions

802. By Soren Hansen on 2011-03-16

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
1=== modified file 'nova/tests/api/openstack/test_ratelimiting.py'
2--- nova/tests/api/openstack/test_ratelimiting.py 2011-02-23 19:56:37 +0000
3+++ nova/tests/api/openstack/test_ratelimiting.py 2011-03-16 11:02:54 +0000
4@@ -1,5 +1,6 @@
5 import httplib
6 import StringIO
7+import os
8 import time
9 import webob
10
11@@ -31,6 +32,11 @@
12 self.assertAlmostEqual(when, delay, 2)
13
14 def test_second(self):
15+ skip_test_env = os.environ.get('SKIP_TIMING_SENSITIVE_TESTS', False)
16+ if skip_test_env:
17+ if not (skip_test_env == '0' or skip_test_env == 'no'):
18+ return
19+
20 self.exhaust('a', 5)
21 time.sleep(0.2)
22 self.exhaust('a', 1)