summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* test to ensure a ConnectionError is raised when a pubsub connection diesAndy McCurdy2019-06-011-0/+13
|
* rough implementation of using nonblocking sockets instead of selectorsAndy McCurdy2019-06-012-124/+2
|
* Pass encoding_errors setting to hiredis (>=1.0.0) (#1162)Brian Candler2019-05-291-0/+14
| | | | | Pass encoding_errors setting to hiredis (>=1.0.0). Fixes #1161
* case insensitive response callbacks.Andy McCurdy2019-05-281-0/+3
| | | | | | | this change allows users to call client.execute_command('info') or client.execute_command('INFO') and get the same parsed result. Fixes #1168
* 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