Commit Graph

108 Commits

Author SHA1 Message Date
Bernie Hackett
507f954ed4 Update copyright dates 2017-12-01 17:23:39 -08:00
Bernie Hackett
e8e77f5a2c PYTHON-1227 - Don't use select.POLLNVAL
It causes problems with Jython and seems unnecessary
since we know the fd represents an open socket.
2017-03-27 17:16:37 -07:00
Bernie Hackett
1108a3a8e0 PYTHON-1222 - Attempt to fix pooling test on zSeries 2017-03-18 15:57:50 -07:00
Shane Harvey
d32d2ff7a5 PYTHON-1227 Disable various pool tests on Jython 2017-02-17 13:55:50 -08:00
Shane Harvey
6f4336efd4 PYTHON-1222 Disable test_max_pool_size_with_connection_failure 2017-02-17 13:55:50 -08:00
Shane Harvey
8156688854 PYTHON-1189 Fix race condition in poll.poll
Each Pool guards its poll.poll with a mutex to prevent concurrent calls.
poll and select are retried if they are interrupted with EINTR. Also fixes
PYTHON-1179.
2016-11-18 16:15:41 -08:00
Shane Harvey
5905a86785 PYTHON-1075 Support running the entire test suite with SSL/TLS
SSL connections are configurable via the environment variables
"CLIENT_PEM", "CA_PEM", and "CERT_REQS".
2016-09-28 16:34:14 -07:00
Bernie Hackett
e89ba4bcd0 PYTHON-1026 - Remove test assumption about primary host 2016-09-21 11:15:43 -07:00
Bernie Hackett
b2a6fc61fd Improve socket_closed test 2015-09-21 14:18:19 -07:00
aherlihy
1fefda2e00 PYTHON-307 Replace select with poll on platforms that support it. 2015-07-08 15:03:11 -07:00
aherlihy
1e7ebb1792 PYTHON-933 - "maxPoolSize=0" allowed, causes hang. 2015-06-08 14:23:00 -07:00
A. Jesse Jiryu Davis
e786e993e6 Delete obsolete test_pool_with_fork. 2015-04-01 12:31:18 -04:00
Bernie Hackett
aec685b374 Fix up copyright dates. 2015-03-25 11:55:02 -07:00
Luke Lovett
7b5ae760a9 Close socket in test_pool_check. 2015-03-25 00:31:07 +00:00
A. Jesse Jiryu Davis
f737ec0db9 PYTHON-728 - Translate socket.error to ConnectionFailure in pool.py.
SocketInfo and Pool are now responsible for catching all socket.errors and
gaierrors and translating them to ConnectionFailure. Server and MongoClient
need no longer worry about anything but ConnectionFailure. Functions in pool.py
and network.py still throw socket.errors into SocketInfo and Pool.
2015-03-11 19:57:01 -04:00
Bernie Hackett
4fd6f8a0b1 PYTHON-854 max_pool_size -> maxPoolSize
With this change the max_pool_size named parameter to
MongoClient is removed. It is replaced by the maxPoolSize
MongoDB URI option, which can be passed in a URI, or as a
keyword argument to MongoClient.
2015-03-09 10:08:13 -07:00
Bernie Hackett
8f0bd0a6d4 PYTHON-850 - Change some uses of ConfigurationError to Type/ValueError. 2015-02-26 16:02:25 -08:00
A. Jesse Jiryu Davis
7f42430978 PYTHON-847 Remove disconnect(), synonym of MongoClient.close().
close() seems more standard among MongoDB drivers.
2015-02-25 14:52:34 -05:00
Bernie Hackett
30af616009 PYTHON-821 - Migrate most tests to new the CRUD API. 2015-02-13 08:46:43 -08:00
A. Jesse Jiryu Davis
9b208caed9 PYTHON-829 Call ismaster on each new connection.
Call ismaster on each new connection and store the results on the SocketInfo
instance.

The upcoming Authentication Spec says: "If credentials exist, upon opening a
socket, drivers MUST send an isMaster command immediately. This allows a driver
to determine whether the server is an Arbiter. Calling ismaster additionally
allows the driver to know if the default authentication method for each socket
is MONGODB-CR or SCRAM-SHA-1, avoiding races when the driver repopulates the
pool after a disconnect."

In theory we could choose not to call ismaster if there are no credentials, but
it's simpler always to call ismaster, and paves the way for future breaking
changes to the wire protocol besides the current breaking change to
authentication.
2015-01-26 16:54:14 -05:00
A. Jesse Jiryu Davis
38a6711e70 PYTHON-829 Move some network code to network.py. 2015-01-26 16:54:00 -05:00
A. Jesse Jiryu Davis
2c2b538367 PYTHON-816 Improved test coverage for Pool. 2015-01-12 21:12:27 -05:00
A. Jesse Jiryu Davis
f769c1e816 Update docstring for a test utility, SocketGetter. 2014-12-10 11:54:43 -05:00
A. Jesse Jiryu Davis
49403798dd Avoid ResourceWarnings in TestPooling. 2014-12-08 17:52:03 -05:00
A. Jesse Jiryu Davis
0b9b109e3c Make Pool.get_socket a context manager.
SocketInfo itself is no longer a context manager.
Simplifies exhaust cursors and exception handling,
and avoids a confusing weakref.
2014-12-03 16:32:41 -05:00
A. Jesse Jiryu Davis
596645b265 Unused import in test_pooling. 2014-11-24 10:08:22 -05:00
A. Jesse Jiryu Davis
92df7906d5 More reliable test_max_pool_size. 2014-11-24 10:01:39 -05:00
A. Jesse Jiryu Davis
e8be121a89 PYTHON-785 Don't use requests in tests. 2014-11-20 22:57:56 -05:00
A. Jesse Jiryu Davis
01dc7fe47e Longer timeout in test_request_with_fork. 2014-11-03 09:39:06 -05:00
A. Jesse Jiryu Davis
0a246d2033 Standardize how tests construct MongoClients. 2014-10-30 19:36:59 -04:00
A. Jesse Jiryu Davis
ee11436675 PYTHON-764 SCRAM-SHA-1 automatic upgrade / downgrade. 2014-10-23 16:30:55 -04:00
A. Jesse Jiryu Davis
98afef5871 Replace "Cluster" term with "Topology".
The Server Discovery And Monitoring Spec has replaced the term "cluster"
with "topology", since "cluster" in MongoDB terminology should be reserved
for sharded clusters. "Topology" describes a single server, replica set, or a
set of mongoses.

The previous commit replaced "cluster" with "topology" in file names. Here
I replace the term in class and variable names.
2014-09-17 22:32:43 -04:00
A. Jesse Jiryu Davis
41c1a9afa6 PYTHON-525 Reimplement auth for new MongoClient.
The new MongoClient, based on Cluster and Server,
includes functionality that had been split between the
old MongoClient and MongoReplicaSetClient. A
previous commit introduced the new MongoClient
but broke authentication.
2014-09-03 17:39:52 -04:00
A. Jesse Jiryu Davis
2f9d24ade6 PYTHON-525 Reimplement MongoClient to use Cluster.
Replace MongoClient with an implementation that relies on Cluster and Server. The new MongoClient takes over MongoReplicaSetClient's responsibilities.

Authentication, secondary-pinning, and Mongos high-availability are broken and will be reimplemented in a future commit. RS tests are temporarily disabled.
2014-08-28 16:57:57 -04:00
A. Jesse Jiryu Davis
f56ba1bff1 No-rendezvous pool tests use the correct pool.
_test_max_pool_size_no_rendezvous had run tests with the MongoClient "self.c", then asserted post-conditions with the local MongoClient "c". So the test passed by accident: it never tested what it thought it tested.

Require tests to pass the client explicitly to the MongoThread to avoid repeating this mistake.
2014-08-11 10:09:12 -04:00
A. Jesse Jiryu Davis
403b93eb84 PYTHON-726 Fix tests to run with Gevent's monkey-patching.
Gevent and multiprocessing work poorly together, so don't use
multiprocessing in test_objectid. Additionally, Gevent 0.13.8
deadlocks with more than about 40 concurrent greenlets on Mac,
so reduce the concurrency to about 20. test_interrupt_signal
still fails with 0.13.8, but others pass, and *all* tests pass
with Gevent 1.0.1:

python -m gevent.monkey setup.py test
2014-07-17 15:13:22 -04:00
A. Jesse Jiryu Davis
648301e082 PYTHON-724 Fix test_pooling for PyPy.
Coding mistakes introduced in 5ce1dd.
2014-07-17 14:03:45 -04:00
A. Jesse Jiryu Davis
be5b4aeff9 PYTHON-724 Remove greenlet- and gevent-specific client tests. 2014-07-15 18:24:51 -04:00
A. Jesse Jiryu Davis
5ce1ddfcce PYTHON-724 Remove greenlet- and gevent-specific pool tests. 2014-07-15 18:24:50 -04:00
Luke Lovett
4fa96c6c2e PYTHON-683 Separate unit tests and integration tests in the pymongo test suite.
Raise SkipTest in tests that require a connection to MongoDB when none is available.
2014-06-30 17:42:29 +00:00
Bernie Hackett
80a789e167 PYTHON-718 - Use SSLContext when available.
This commit also introduces a fake SSLContext class
for use in python versions that don't provide one.
2014-06-25 16:09:55 -07:00
Luke Lovett
141200083e PYTHON-680 Stop using nose in favor of pure unittest/unittest2 2014-04-25 22:57:33 +00:00
Luke Lovett
4d6d1e067b PYTHON-676 python 2/3 single-source for the test module 2014-04-23 18:37:02 +00:00
A. Jesse Jiryu Davis
de9062cf50 Reduce numbers of threads and trials in tests. 2014-02-12 15:59:13 -05:00
A. Jesse Jiryu Davis
2fa1750b07 Update copyright notices and company name. 2014-01-31 09:36:46 -05:00
A. Jesse Jiryu Davis
8f6a34326e Improve multithreaded connection and reconnection in MongoClient, PYTHON-487. 2013-12-04 21:09:15 -05:00
behackett
56753b8a45 Fix test failure on OSX due to low ulimit. 2013-06-24 19:43:20 -07:00
Justin Patrin
8fe3154138 PYTHON-436 Change max_pool_size to limit the maximum concurrent connections rather than just the idle connections in the pool. Also add support for waitQueueTimeoutMS and waitQueueMultiple. 2013-05-22 20:33:14 -04:00
A. Jesse Jiryu Davis
88d09e0a0b Don't run test_max_pool_size_with_leaked_request_massive with greenlets
Can restore once Gevent 1.0 lands, but 0.13.8 still deadlocks on this test on Mac; not PyMongo's bug.
2013-04-27 14:04:04 -04:00
A. Jesse Jiryu Davis
8536acb4a0 Standardize tests' handling of DB_IP and DB_PORT, fix PYTHON-475 2013-02-19 15:09:28 -05:00