diff options
author | Roger Hu <roger.hu@gmail.com> | 2013-06-04 18:27:27 -0700 |
---|---|---|
committer | Wouter Bolsterlee <uws@xs4all.nl> | 2013-06-07 23:46:11 +0200 |
commit | 4daef2bb43f7fdadba4594d9e099ff85f7b0393b (patch) | |
tree | 8f447274909246ae611a27e7d5f62ecf2bfa0e64 | |
parent | f789d0194b2e75264c0d31eb832288f72469d914 (diff) | |
download | happybase-4daef2bb43f7fdadba4594d9e099ff85f7b0393b.tar.gz |
Reduce test loop and add more random failures to simulate the functionality.
-rw-r--r-- | tests/test_api.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/test_api.py b/tests/test_api.py index c3c7022..f2deaaf 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -477,11 +477,12 @@ def test_connection_pool(): assert connection is another_connection # Fake an exception once in a while - if random.random() < .001: + if random.random() < .25: + print "Introducing random failure" connection.transport.close() raise TTransportException("Fake transport exception") - for i in xrange(100): + for i in xrange(50): with pool.connection() as connection: connection.tables() @@ -497,7 +498,7 @@ def test_connection_pool(): print "Thread %s done" % name - N_THREADS = 50 + N_THREADS = 10 pool = ConnectionPool(size=3, **connection_kwargs) threads = [threading.Thread(target=run) for i in xrange(N_THREADS)] |