summaryrefslogtreecommitdiff
path: root/tests/test_connection_pool.py
Commit message (Collapse)AuthorAgeFilesLines
* Reorganizing the parsers code, and add support for RESP3 (#2574)dvora-h2023-03-231-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Reorganizing the parsers code * fix build package * fix imports * fix flake8 * add resp to Connection class * core commands * python resp3 parser * pipeline * async resp3 parser * some asymc tests * resp3 parser for async cluster * async commands tests * linters * linters * linters * fix ModuleNotFoundError * fix tests * fix assert_resp_response_in * fix command_getkeys in cluster * fail-fast false * version --------- Co-authored-by: Chayim I. Kirshen <c@kirshen.com>
* Combine auto-concatenated strings (#2482)David Gilman2022-12-141-1/+1
|
* Handle auth errors for newer versions of Redis. (#2325) (#2329)Luca Cillario2022-08-301-5/+23
|
* Be more strict about url scheme parsing (#2343)Klaas van Schelven2022-08-211-0/+8
| | | | | | | | | | The error message implied that urls had to start with `scheme://`. However, if the double slash was left out, the url parsed just fine and the part that was ostensibly intended to be the hostname ended up as part of the path, whereas the default (localhost) would be used for the hostname. This commit makes the check as strict as the error message implies by including a check for the double slash. Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com>
* update black to 22.3.0 (#2171)Utkarsh Gupta2022-05-301-55/+15
|
* Added support for MONITOR in clusters (#1756)Bar Shaul2021-12-021-6/+6
|
* Fixing lint merge issue (#1770)Chayim2021-12-021-2/+2
|
* Allow overriding connection class via keyword arguments (#1752)Maksim Novikov2021-12-021-0/+18
|
* Added black and isort (#1734)Anas2021-11-301-278/+291
|
* Adding RedisCluster client to support Redis Cluster Mode (#1660)Bar Shaul2021-11-251-0/+5
| | | | Co-authored-by: Chayim <chayim@users.noreply.github.com> Co-authored-by: Anas <anas.el.amraoui@live.com>
* Fixes to allow --redis-url to pass through all tests (#1700)Chayim2021-11-111-1/+11
|
* Unit test fixes to carry pytest options through all tests (#1696)Chayim2021-11-101-8/+9
|
* Removing the REDIS_6_VERSION placeholder (#1582)Chayim2021-10-111-6/+6
|
* All values within Redis URLs are url-unquoted via default.Andy McCurdy2020-08-151-114/+16
| | | | | | | | Prior versions of redis-py supported this by specifying the ``decode_components`` flag to the ``from_url`` functions. This is now done by default and cannot be disabled. Fixes #589
* Remove support for end-of-life Python 2.7 (#1318)Jon Dufresne2020-08-061-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove support for end-of-life Python 2.7 Python 2.7 is end of life. It is no longer receiving bug fixes, including for security issues. Python 2.7 went EOL on 2020-01-01. For additional details on support Python versions, see: Supported: https://devguide.python.org/#status-of-python-branches EOL: https://devguide.python.org/devcycle/#end-of-life-branches Removing support for EOL Pythons will reduce testing and maintenance resources while allowing the library to move towards a modern Python 3 style. Python 2.7 users can continue to use the previous version of redis-py. Was able to simplify the code: - Removed redis._compat module - Removed __future__ imports - Removed object from class definition (all classes are new style) - Removed long (Python 3 unified numeric types) - Removed deprecated __nonzero__ method - Use simpler Python 3 super() syntax - Use unified OSError exception - Use yield from syntax Co-authored-by: Andy McCurdy <andy@andymccurdy.com>
* rename absurdly long test nameAndy McCurdy2020-07-151-1/+1
|
* Attempt to fix a timing bugAndrew Brookins2020-07-141-1/+1
|
* Fix flake8 errorsAndrew Brookins2020-07-091-1/+1
|
* Pass the master hostname to testsAndrew Brookins2020-07-091-16/+26
|
* Fix typo (missing space) in exception message (#1334)Jon Dufresne2020-04-281-1/+5
|
* constant for redis 6 RC candidates in tests.Andy McCurdy2020-03-121-6/+6
| | | | replace with a '6.0.0' literal when Redis 6 is GA
* remove Redis and ConnectionPool __eq__ comparisonAndy McCurdy2020-02-011-41/+0
| | | | | | | | | | | | | After further thought this was a bad idea. Just because two connection pools share the same connection arguments does not make them equal. It would seem quite odd if pool_a == pool_b yet pool_a.disconnect() doesn't close all of pool_b's connections. Ref #1240 Fixes #1277 Fixes #1275 Fixes #1267 Fixes #1273
* Added the 'ssl_check_hostname' option.Andy McCurdy2019-12-291-0/+8
| | | | | | | | 'ssl_check_hostname' tells SSL Connections to whether to require the TCP hostname to match the hostname specified in the SSL Cert. By default 'ssl_check_hostname' is False to maintain backwards compatibility. Fixed #1196
* Allow setting client_name during connection construction.Peter van Dijk2019-12-291-7/+38
| | | | | | Client instances and Connection pools now accept "client_name" as an optional argument. If supplied, all connections created will be named via CLIENT SETNAME once the connection to the server is established.
* Added support for ACL commandsAndy McCurdy2019-12-281-0/+82
|
* Add equality test on Redis client and conn pool (#1240)Rajiv Bakulesh Shah2019-11-111-0/+41
| | | Add equality test on Redis client and connection pool
* PING/PONG health checksAndy McCurdy2019-07-281-1/+178
| | | | | | | | | | | | | | | | | | | | | | The `Redis` class and the `ConnectionPool` class now support the "health_check_interval=N" option. By default N=0, which turns off health checks. `N` should be an integer, and when greater than 0, ensures that a health check is performed just before command execution anytime the underlying connection has been idle for more than N seconds. A health check is a full PING/PONG round trip to the Redis server. If a health check encounters a ConnectionError or TimeoutError, the connection is disconnected and reconnected and the health check is retried exactly once. Any error during the retry is raised to the caller. Health check retries are not governed by any other options such as `retry_on_timeout`. In systems where idle times are common, these health checks are the intended way to reconnect to the Redis server without harming any user data. When this option is enabled for PubSub connections, calling `get_message()` or `listen()` will send a health check anytime a message has not been read on the PubSub connection for `health_check_interval` seconds. Users should call `get_message()` or `listen()` at least every `health_check_interval` seconds in order to keep the connection open.
* Ability to create a client that uses a single connectionAndy McCurdy2019-07-231-4/+15
| | | | | | | | | | | | | This has multiple uses: * Single connection clients will not be considered threadsafe. This means certain settings could temporarily be adjusted. For example, a context manager could temporarily modify the encoding behavior for a set of commands. * We can introduce more thorough health checks that only happen when a connection is handed out from the connection pool. * Workloads that issue many commands to Redis should be slightly faster. Prior to this change, the client must retrieve a connection from the pool for each command.
* Use nonblocking sockets instead of selectors for healthy connectionsAndy McCurdy2019-07-091-2/+2
| | | | | | | This replaces the work in 3.2.0 to use nonblocking sockets instead of selectors. Selectors proved to be problematic for some environments including eventlet and gevent. Nonblocking sockets should be available in all environments.
* All authentication-related errors now raise AuthenticationErrorAndy McCurdy2019-06-031-0/+14
| | | | | | | AuthenticationError is now a subclass of ConnectionError, which means the connection will be shut down and cleaned up. Fixes #923
* test all selectors via pytest parameterizationhealty_connectionsAndy McCurdy2019-02-111-48/+0
|
* attempt to provide only healthy connections from the poolAndy McCurdy2019-02-041-5/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | Adds redis.selector, a module that provides the best selector strategy available on the current platform. A redis.selector polls a socket to provide two pieces of functionality: 1. Check whether data can be read from the socket. Prior versions of redis-py provided this behavior with just select.select(). select() has lots of limitations, most notably a limit of ~1024 file descriptors. Now that better selectors are available, this should make can_read() faster and able to accomodate more clients. See #1115 and #486 2. Check whether a socket is ready for a command to be sent. This doubles as a health check. It ensures that the socket is available for writing, has no data to read and has no known errors. Anytime a socket is disconnected or hung up, data is available to be read, typically zero bytes. ConnectionPool.get_connection has been modified to ensure that connections it returns are connected and are ready for a command to be sent. If get_connection encounters a case where a socket isn't ready for a command the connection is reconnected and checked again. TODO: more tests for this stuff. implement EPoll and KQueue selectors. Fixes #1115 Fixes #486
* Connection URLs must have a valid scheme.Andy McCurdy2019-01-271-0/+4
| | | | | Fixes #969 Fixes #961
* remove legacy Redis classAndy McCurdy2018-11-131-1/+1
| | | | | | | | | | | | | | | | | | | redis-py maintained backwards compatibility by keeping the old "Redis" class around for quite some time. While no doubt a convenience for folks who relied on it, the presence of both Redis and StrictRedis causes a number of support issues and general confusion. With 3.0, we're breaking a few things to make redis-py better going forward. This change removes the old Redis class. We also renamed the StrictRedis class to Redis and aliased StrictRedis to Redis. For people that have been using StrictRedis, this should not change anything. You can continue doing things as you are. People still using the legacy Redis class will need to update the argument order for the SETEX, LREM and ZADD commands. Additionally, the return values for TTL and PTTL now return the integer values -1 when a key exists but has no expire time and -2 when a key does not exist. Previously these cases returned a None value in the Redis class.
* Remove from __future__ import with_statementJon Dufresne2018-11-031-1/+0
| | | | All supported Python versions support the with statement.
* Fix parsing max_connections URL query string parameterMichał Masłowski2018-05-231-1/+2
| | | | | Previously ConnectionPool.from_url kept it as a string, causing a 'ValueError: "max_connections" must be a positive integer'.
* PEP8 fixesTim Savage2016-03-291-3/+11
|
* Extend ConnectionPool.to_url to parse querystring arguments to correct type.Tim Savage2016-03-291-1/+38
| | | | | Previously if a value for socket_timeout was supplied as part fo the URL an error would be raised when a socket was created with an invalid type, this change fixes that by parsing `socket_timeout`, `socket_connect_timeout` to float values. In addition the boolean values `socket_keepalive` and `retry_on_timeout` are parsed to bool types taking into account the usage of True/False, Yes/No strings.
* Handle percent-encoded URLs in parsing codePaul Keene2015-02-091-0/+45
|
* consistent naming, #446Andy McCurdy2014-05-141-3/+5
|
* allow cert_reqs to be a string and convert it to the appropriate SSL constant.Andy McCurdy2014-05-131-0/+26
|
* Cleaned up URL parsing code, now returns ConnectionPool instances.Andy McCurdy2014-05-111-187/+191
| | | | | | | StrictRedis.from_url() now creations a connection pool instance and passes that as the connection_pool argument to the client class. Cleaned up the test suite for URL parsing and BlockingConnectionPool tests
* Merge branch 'pr/436'Andy McCurdy2014-05-111-0/+145
|\ | | | | | | | | Conflicts: tests/test_connection_pool.py
| * pep8 fixeswil paredes2014-02-091-12/+12
| |
| * add from_url() classmethod to ConnectionPool and BlockingConnectionPool, add ↵wil paredes2014-02-091-0/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ability to parse UNIX domain socket URLs * add redis.connection.parse_url() * moved code from StrictRedis.from_url() to here * add ability to parse UNIX domain socket URLs * return keyword args to pass to StrictRedis.__init__() * StrictRedis.from_url() - call parse_url() to get keyword args * add classmethod from_url() to ConnectionPool and BlockingConnectionPool * get keyword args from parse_url() * touch up keyword args from StrictRedis format for connection pool * tests/test_connection_pool.py * add from_url() tests for ConnectionPool and BlockingConnectionPool * add from_url() tests for a single Redis client object
* | SentinelManagedConnections to master servers disconnect on READONLY errors.Andy McCurdy2014-05-061-0/+6
| | | | | | | | | | Any attempt to reconnect will force all connections in that pool to update their connections to the new master. Fixes #435
* | better error handling with hiredis. fully fixes #456Andy McCurdy2014-04-211-15/+14
| |
* | mostly fixes #456. there's still an issue w/ hiredis and multi-bulk repliesAndy McCurdy2014-04-101-0/+31
| |
* | DEBUG LOADING was released in 2.8.8, so skip test with earlier versionsAndy McCurdy2014-03-311-2/+1
| |
* | make sure we know the order of expected subscribe/unsubscribe messagesAndy McCurdy2014-03-291-3/+0
| |