summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* remove Token class in favor of bytestringremove_tokenAndy McCurdy2019-05-281-1/+1
| | | | | | | The Token class was needed when supporting Python 2.6. Now that we've dropped support for 2.6, we don't need it anymore. Fixes #1066
* fix py2 compatmonitorAndy McCurdy2019-05-261-2/+3
|
* add tests for encoding issues and fix bugs foundAndy McCurdy2019-05-261-5/+12
|
* monitor command now has full command text. test suite improvedAndy McCurdy2019-05-261-4/+33
|
* Added support for the monitor command.Doug Kisabaka2019-02-251-0/+10
|
* test all selectors via pytest parameterizationhealty_connectionsAndy McCurdy2019-02-112-48/+122
|
* 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
* Improve how connection pools operate in forked/child proceeses.Andy McCurdy2019-01-311-21/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes a process with an active connection to Redis forks and creates child processes taht also want to talk to Redis. Prior to this change there were a number of potential conflicts that could cause this to fail. Retrieving a connection from the pool and releasing a connection back to the pool check the current proceeses PID. If it's different than the PID that created the pool, reset() is called to get a fresh set of connections for the current process. However in doing so, pool.disconnect() was caused which closes the file descriptors that the parent may still be using. Further when the available_connections and in_use_connections lists are reset, all of those connections inherited from the parent are GC'd and the connection's `__del__` was called, which also closed the socket and file descriptor. This change prevents pool.disconnect() from being called when a pid is changed. It also removes the `__del__` destructor from connections. Neither of these are necessary or practical. Child processes still reset() their copy of the pool when first accessed causing their own connections to be created. `ConnectionPool.disconnect()` now checks the current process ID so that a child or parent can't disconnect the other's connections. Additionally, `Connection.disconnect()` now checks the current process ID and only calls `socket.shutdown()` if `disconnect()` is called by the same process that created the connection. This allows for a child process that inherited a connection to call `Connection.disconnect()` and not shutdown the parent's copy of the socket. Fixes #863 Fixes #784 Fixes #732 Fixes #1085 Fixes #504
* Merge branch 'pr/1108' into pythonparserAndy McCurdy2019-01-281-0/+130
|\
| * update test to expect errorsAlexey Popravka2019-01-031-5/+8
| |
| * Add failing tests to show difference between protocol parsers on_disconnectAlexey Popravka2019-01-031-0/+127
| | | | | | | | | | | | | | implementation/behavior (related to #1085). When hiredis is installed and HiredisParser is used (implicitly), connection can not be securily shared between process forks.
* | Merge pull request #972 from lamby/dont-assume-64-bit-server-in-testsAndy McCurdy2019-01-272-8/+20
|\ \ | | | | | | Skip 64-bit specific tests. (Closes: #899)
| * | Skip 64-bit specific tests. (Closes: #899)Chris Lamb2018-11-162-8/+20
| | | | | | | | | | | | Signed-off-by: Chris Lamb <lamby@debian.org>
* | | Connection URLs must have a valid scheme.Andy McCurdy2019-01-271-0/+4
| | | | | | | | | | | | | | | Fixes #969 Fixes #961
* | | the fix to TimeoutErrors had a side affect on test teardownsAndy McCurdy2019-01-271-1/+6
| | |
* | | Added a test for #1126Andy McCurdy2019-01-271-2/+2
| | |
* | | Fixes #1116Andy McCurdy2019-01-271-1/+1
| | |
* | | Merge branch 'master' into xreadgroup_handle_nil_fieldsAndy McCurdy2019-01-271-0/+9
|\ \ \
| * | | Added noack option for XREADGROUPJohn T. Myers2019-01-101-0/+10
| | |/ | |/|
* | | Fix #1116 - trimmed stream causes exception on xreadgroup with id 0Xabier Eizmendi2019-01-101-0/+16
|/ / | | | | | | | | | | messages Signed-off-by: Xabier Eizmendi <xeizmendi@gmail.com>
* | Lock objects now support specifying token values and ownership checkingAndy McCurdy2019-01-021-0/+40
| | | | | | | | | | | | | | | | Lock.acquire() can now be provided a token. If provided, this value will be used as the value stored in Redis to hold the lock. Lock.owned() returns a boolean indicating whether the lock is owned by the current instance.
* | Add `.reacquire()` method to LockIhor Kalnytskyi2018-12-281-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | `Lock` class provides a method called `.extend()` to manage a TTL of the acquired lock. However, the method allows only to extend a timeout of existing lock by N seconds, there's no way you can reset a TTL to the timeout value you passed to this lock. There could be multiple use cases for such behaviour. For instance, one may want to use a lock to implement active/passive behaviour where only one process owns a lock and resets its TTL all over again until it dies. This commit adds a new method called `.reacquire()` to reset a TTL of the acquired lock back to the passed timeout value.
* | Encode Stream message names within XREAD and XREADGROUP responses correctlyAndy McCurdy2018-12-271-5/+5
| | | | | | | | Stream message now respect the decode_responses flag.
* | redis >= 5.0.1 changed behavior of XREADGROUP stream IDAndy McCurdy2018-12-271-38/+25
| | | | | | | | | | | | | | Redis versions 5.0.1 require messages to be read with the special ID '>' when using XREADGROUP Fixes #1073
* | ZADD correctly returns None in certain edge cases when incr=TrueAndy McCurdy2018-12-271-0/+6
| | | | | | | | | | | | | | When incr=True and xx=True and an element is specified that doesn't exist the Redis server returns None. redis-py now does this as well. Fixes #1084
* | Merge pull request #1098 from theodesp/client-kill-filterAndy McCurdy2018-12-172-0/+61
|\ \ | | | | | | Add client kill with filter
| * | Added test case for filterTheo Despoudis2018-12-081-0/+21
| | | | | | | | | | | | Signed-off-by: Theo Despoudis <thdespou@hotmail.com>
| * | Code review fixesTheo Despoudis2018-12-062-29/+23
| | | | | | | | | | | | Signed-off-by: Theo Despoudis <thdespou@hotmail.com>
| * | Add client kill with filterTheo Despoudis2018-12-042-0/+46
| | | | | | | | | | | | Signed-off-by: Theo Despoudis <thdespou@hotmail.com>
* | | Fix code styleMarcin Raczyński2018-12-171-2/+4
| | |
* | | Fix #764 - sub-unsub-resub caused PubSub() to forget the channelMarcin Raczyński2018-12-171-0/+40
|/ /
* | rename new LockErrorNotOwned to LockNotOwnedErrorAndy McCurdy2018-12-031-3/+3
| |
* | Extend lock error for not owned special caseJoshua Harlow2018-12-031-4/+4
| | | | | | | | | | | | | | | | Using the locking routines, it is useful to be able to distingush a generic lock error from a one that is related to the lock not being owned anymore (without doing string checks); this allows say a lock extension thread to attempt to re-acquire the lock in this case (vs just dying).
* | Remove decoding from georadiusBo Bayles2018-11-211-11/+11
| |
* | Don't destroy data in GEORADIUS commandsBo Bayles2018-11-201-4/+5
|/
* saner handling of decr/incr vs decrby/incrbyAndy McCurdy2018-11-141-0/+5
|
* Merge pull request #925 from itamarhaber/sort_issueAndy McCurdy2018-11-141-0/+5
|\ | | | | Fixes a KeyError in empty `options` dict at sort's return
| * Fixes a KeyError in empty `options` dict at sort's returnItamar Haber2017-11-131-0/+5
| | | | | | | | Fixes #924
* | Add test to make sure geodist with a missing member returns NoneAndy McCurdy2018-11-141-0/+6
| | | | | | | | Fixes #939
* | add locked() method to lock objectAndy McCurdy2018-11-141-0/+8
| | | | | | | | | | | | | | Lock.locked() returns a boolean indicating if the lock is acquired and valid. Thanks Alan Justino da Silva Fixes #1007
* | EXISTS now accepts multiple keys. return the number of existing keysAndy McCurdy2018-11-141-2/+4
| | | | | | | | | | | | Fixes #1053 Fixes #635 Fixes #766
* | add nx, xx, ch and incr options to ZADDAndy McCurdy2018-11-141-0/+34
| | | | | | | | | | | | | | | | Fixes #649 Fixes #954 Fixes #638 Fixes #721 Fixes #955
* | raise a LockError when the context manager fails to acquire a lockv3-breaking-changesAndy McCurdy2018-11-141-0/+6
| | | | | | | | | | Fixes #621 Fixes #927
* | only support LuaLock going forwardAndy McCurdy2018-11-141-53/+9
| | | | | | | | | | | | | | | | | | | | Everyone is using Redis 2.6 or greater, right? The Lua lock implementation is so much nicer and less buggy. Fixes #1031 Fixes #902 Fixes #793 Fixes #610
* | only accept bytes, strings, ints, longs and floats as user inputAndy McCurdy2018-11-141-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All input sent to Redis is coerced into bytes. This includes key names and values. Prior to this change, redis-py made an effort to cooerce all input into strings by calling str() (Python 3) or unicode() (Python 2). While this works for a handful of types like ints, longs and floats, it fails for other types like bools ('True' or 'False'), None ('None') and many user defined types. Starting with redis-py version 3.0, sending input of any other type is considered an error an a DataError exception will be raised. Fixes #471 Fixes #472 Fixes #321 Fixes #190
* | fix order of zincrby args to match redis serverAndy McCurdy2018-11-142-3/+3
| | | | | | | | fixes #571
* | remove legacy Redis classAndy McCurdy2018-11-136-172/+169
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | force mapping to be a single dict object on MSET, MSETNX and ZADDAndy McCurdy2018-11-131-16/+2
| | | | | | | | | | | | | | | | | | Previously MSET, MSETNX and ZADD accepted multiple ways to specify the mapping of keys to values including via **kwargs. This turned out to be a poor choice. As Redis evolved and added additional options to the ZADD command, these options couldn't be specified in redis-py without possible element name conflictd. This fixes that going forward and makes the commands simpler.
* | Merge pull request #1057 from RoeyPrat/roey-client_pauseAndy McCurdy2018-11-131-0/+15
|\ \ | | | | | | CLIENT PAUSE and type argument in client_list
| * | Implements type argument in client_listRoey Prat2018-11-071-0/+8
| | |