Reduce numbers of threads and trials in tests.

This commit is contained in:
A. Jesse Jiryu Davis 2014-02-11 18:16:01 -05:00
parent e3c809bd02
commit de9062cf50
5 changed files with 4 additions and 44 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -463,7 +463,7 @@ class _TestLazyConnectMixin(object):
"""
use_greenlets = False
NTRIALS = 10
NTRIALS = 5
NTHREADS = 10
def test_insert(self):