diff options
author | huangwei-ds5 <huangwei-ds5@gome.com.cn> | 2019-08-09 15:54:57 +0800 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2019-08-19 12:30:39 -0700 |
commit | d811ae71dbdbeeb4fc0ee73a96b7fbdb1aec8522 (patch) | |
tree | 928cee652b10c7ae6d0ba974ef47423f60a9f94f /tests/test_monitor.py | |
parent | f0516c9f7589557883a5eb23a44531066e275950 (diff) | |
download | redis-py-d811ae71dbdbeeb4fc0ee73a96b7fbdb1aec8522.tar.gz |
version 3.3.8, fix MONITOR output to account for all types of clients3.3.8
The client section of MONITOR output varies for TCP connections, unix socket
connections and commands executed from Lua scripts. Account for each of these
cases by including an additional key `client_type` in the MONITOR output.
`client_type` will be one of ('tcp', 'unix', 'lua'). `client_address` and
`client_port` vary based on the `client_type`.
Fixes #1201
Diffstat (limited to 'tests/test_monitor.py')
-rw-r--r-- | tests/test_monitor.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_monitor.py b/tests/test_monitor.py index 9e9ee83..09ec21b 100644 --- a/tests/test_monitor.py +++ b/tests/test_monitor.py @@ -29,6 +29,7 @@ class TestPipeline(object): response = wait_for_command(r, m, 'PING') assert isinstance(response['time'], float) assert response['db'] == 9 + assert response['client_type'] in ('tcp', 'unix') assert isinstance(response['client_address'], unicode) assert isinstance(response['client_port'], unicode) assert response['command'] == 'PING' @@ -45,3 +46,13 @@ class TestPipeline(object): r.get(byte_string) response = wait_for_command(r, m, 'GET foo\\x92') assert response['command'] == 'GET foo\\x92' + + def test_lua_script(self, r): + with r.monitor() as m: + script = 'return redis.call("GET", "foo")' + assert r.eval(script, 0) is None + response = wait_for_command(r, m, 'GET foo') + assert response['command'] == 'GET foo' + assert response['client_type'] == 'lua' + assert response['client_address'] == 'lua' + assert response['client_port'] == '' |