From de9062cf50b10d3d498e56661e261f1ec6111112 Mon Sep 17 00:00:00 2001 From: "A. Jesse Jiryu Davis" Date: Tue, 11 Feb 2014 18:16:01 -0500 Subject: [PATCH] Reduce numbers of threads and trials in tests. --- test/slow/test_high_concurrency.py | 35 ------------------------------ test/test_pooling.py | 5 ----- test/test_pooling_base.py | 4 ++-- test/test_threads.py | 2 +- test/utils.py | 2 +- 5 files changed, 4 insertions(+), 44 deletions(-) delete mode 100644 test/slow/test_high_concurrency.py diff --git a/test/slow/test_high_concurrency.py b/test/slow/test_high_concurrency.py deleted file mode 100644 index 3ba94b66e..000000000 --- a/test/slow/test_high_concurrency.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2013-2014 MongoDB, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Test built in connection-pooling with lots of threads.""" - -import unittest -import sys - -sys.path[0:0] = [""] - -from test.test_pooling_base import _TestMaxPoolSize - - -class TestPoolWithLotsOfThreads(_TestMaxPoolSize, unittest.TestCase): - use_greenlets = False - - def test_max_pool_size_with_leaked_request_super_massive(self): - # Like test_max_pool_size_with_leaked_request_massive but even more - # threads. Tests that socket reclamation works under high load, - # especially in Python <= 2.7.0. You may need to raise ulimit. - # See http://bugs.python.org/issue1868. - nthreads = 1000 - self._test_max_pool_size( - 2, 1, max_pool_size=2 * nthreads, nthreads=nthreads) diff --git a/test/test_pooling.py b/test/test_pooling.py index 2e14356f0..1aa07d095 100644 --- a/test/test_pooling.py +++ b/test/test_pooling.py @@ -164,11 +164,6 @@ class TestPoolingThreads(_TestPooling, unittest.TestCase): class TestMaxPoolSizeThreads(_TestMaxPoolSize, unittest.TestCase): use_greenlets = False - def test_max_pool_size_with_leaked_request_massive(self): - nthreads = 50 - self._test_max_pool_size( - 2, 1, max_pool_size=2 * nthreads, nthreads=nthreads) - class TestPoolSocketSharingThreads(_TestPoolSocketSharing, unittest.TestCase): use_greenlets = False diff --git a/test/test_pooling_base.py b/test/test_pooling_base.py index 1e3a832ff..5efb3a22d 100644 --- a/test/test_pooling_base.py +++ b/test/test_pooling_base.py @@ -36,7 +36,7 @@ from test import version, host, port from test.test_client import get_client from test.utils import delay, is_mongos, one, get_pool -N = 50 +N = 10 DB = "pymongo-pooling-tests" @@ -899,7 +899,7 @@ class _TestMaxPoolSize(_TestPoolingBase): # On the other hand, nthreads had better be much larger than # max_pool_size to ensure that max_pool_size sockets are actually # required at some point in this test's execution. - nthreads = 30 + nthreads = 10 if (sys.platform.startswith('java') and start_request > end_request diff --git a/test/test_threads.py b/test/test_threads.py index e258958e7..c21f9fbf9 100644 --- a/test/test_threads.py +++ b/test/test_threads.py @@ -259,7 +259,7 @@ class BaseTestThreads(object): assert isinstance(socket_info, SocketInfo) request_sock = socket_info.sock - state = FindPauseFind.create_shared_state(nthreads=40) + state = FindPauseFind.create_shared_state(nthreads=10) threads = [ FindPauseFind(collection, state) diff --git a/test/utils.py b/test/utils.py index a2f48690b..2867e83f7 100644 --- a/test/utils.py +++ b/test/utils.py @@ -463,7 +463,7 @@ class _TestLazyConnectMixin(object): """ use_greenlets = False - NTRIALS = 10 + NTRIALS = 5 NTHREADS = 10 def test_insert(self):