Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raising NotImplementedError for SCRIPT DEBUG and DEBUG SEGFAULT #1624

Merged
merged 1 commit into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions redis/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,11 @@ def debug_object(self, key):
"""Returns version specific meta information about a given key"""
return self.execute_command('DEBUG OBJECT', key)

def debug_segfault(self):
raise NotImplementedError(
"DEBUG SEGFAULT is intentionally not implemented in the client."
)

def echo(self, value):
"""Echo the string back from the server"""
return self.execute_command('ECHO', value)
Expand Down Expand Up @@ -2876,6 +2881,11 @@ def script_exists(self, *args):
"""
return self.execute_command('SCRIPT EXISTS', *args)

def script_debug(self, *args):
raise NotImplementedError(
"SCRIPT DEBUG is intentionally not implemented in the client."
)

def script_flush(self, sync_type="SYNC"):
"""Flush all scripts from the script cache.
``sync_type`` is by default SYNC (synchronous) but it can also be
Expand Down
20 changes: 20 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1624,6 +1624,16 @@ def test_sunionstore(self, r):
assert r.sunionstore('c', 'a', 'b') == 3
assert r.smembers('c') == {b'1', b'2', b'3'}

@skip_if_server_version_lt('1.0.0')
def test_debug_segfault(self, r):
with pytest.raises(NotImplementedError):
r.debug_segfault()

@skip_if_server_version_lt('3.2.0')
def test_script_debug(self, r):
with pytest.raises(NotImplementedError):
r.script_debug()

# SORTED SET COMMANDS
def test_zadd(self, r):
mapping = {'a1': 1.0, 'a2': 2.0, 'a3': 3.0}
Expand Down Expand Up @@ -3530,6 +3540,16 @@ def test_bitfield_operations(self, r):
.execute())
assert resp == [0, None, 255]

@skip_if_server_version_lt('4.0.0')
def test_memory_help(self, r):
with pytest.raises(NotImplementedError):
r.memory_help()

@skip_if_server_version_lt('4.0.0')
def test_memory_doctor(self, r):
with pytest.raises(NotImplementedError):
r.memory_doctor()

@skip_if_server_version_lt('4.0.0')
def test_memory_malloc_stats(self, r):
assert r.memory_malloc_stats()
Expand Down