making unit tests work a little better
This commit is contained in:
parent
29d3887572
commit
73c3db6d1b
@ -17,7 +17,7 @@ there will be no rate limiting. Configuration available:
|
||||
|
||||
======================== ========= ===========================================
|
||||
Option Default Description
|
||||
---------------------- --------- -------------------------------------------
|
||||
------------------------ --------- -------------------------------------------
|
||||
clock_accuracy 1000 Represents how accurate the proxy servers'
|
||||
system clocks are with each other. 1000
|
||||
means that all the proxies' clock are
|
||||
@ -38,8 +38,8 @@ account_blacklist '' Comma separated lists of account names that
|
||||
container_ratelimit_size '' When set with container_limit_x = r:
|
||||
for containers of size x, limit requests
|
||||
per second to r. Will limit GET and HEAD
|
||||
requests to /account_name/container_name and
|
||||
PUTs and DELETEs to
|
||||
requests to /account_name/container_name
|
||||
and PUTs and DELETEs to
|
||||
/account_name/container_name/object_name
|
||||
======================== ========= ===========================================
|
||||
|
||||
|
@ -204,8 +204,7 @@ class TestRateLimit(unittest.TestCase):
|
||||
''.join(t.result).startswith('Slow down')]
|
||||
self.assertEquals(len(the_498s), 0)
|
||||
time_took = time.time() - begin
|
||||
# the 4th request will happen at 1.5
|
||||
self.assert_(round(time_took, 1) == 0)
|
||||
self.assert_(time_took < 1)
|
||||
|
||||
def test_ratelimit_blacklist(self):
|
||||
current_rate = 2
|
||||
@ -280,7 +279,7 @@ class TestRateLimit(unittest.TestCase):
|
||||
the_498s = [t for t in all_results if t.startswith('Slow down')]
|
||||
self.assertEquals(len(the_498s), 2)
|
||||
time_took = time.time() - begin
|
||||
self.assert_(round(time_took, 1) == 1.5)
|
||||
self.assert_(1.5 <= round(time_took,1) < 1.7, time_took)
|
||||
|
||||
def test_ratelimit_max_rate_multiple_acc(self):
|
||||
num_calls = 4
|
||||
@ -317,7 +316,7 @@ class TestRateLimit(unittest.TestCase):
|
||||
thread.join()
|
||||
time_took = time.time() - begin
|
||||
# the all 15 threads still take 1.5 secs
|
||||
self.assert_(round(time_took, 1) == 1.5)
|
||||
self.assert_(1.5 <= round(time_took,1) < 1.7)
|
||||
|
||||
def test_ratelimit_acc_vrs_container(self):
|
||||
conf_dict = {'clock_accuracy': 1000,
|
||||
|
Loading…
Reference in New Issue
Block a user