MCPcopy
hub / github.com/redis/redis-py / slowlog

Function slowlog

tests/test_cluster.py:150–171  ·  view source on GitHub ↗

Set the slowlog threshold to 0, and the max length to 128. This will force every command into the slowlog and allow us to test it

(request, r)

Source from the content-addressed store, hash-verified

148
149@pytest.fixture()
150def slowlog(request, r):
151 """
152 Set the slowlog threshold to 0, and the
153 max length to 128. This will force every
154 command into the slowlog and allow us
155 to test it
156 """
157 # Save old values
158 current_config = r.config_get(target_nodes=r.get_primaries()[0])
159 old_slower_than_value = current_config["slowlog-log-slower-than"]
160 old_max_legnth_value = current_config["slowlog-max-len"]
161
162 # Function to restore the old values
163 def cleanup():
164 r.config_set("slowlog-log-slower-than", old_slower_than_value)
165 r.config_set("slowlog-max-len", old_max_legnth_value)
166
167 request.addfinalizer(cleanup)
168
169 # Set the new values
170 r.config_set("slowlog-log-slower-than", 0)
171 r.config_set("slowlog-max-len", 128)
172
173
174def get_mocked_redis_client(

Callers

nothing calls this directly

Calls 3

config_getMethod · 0.45
get_primariesMethod · 0.45
config_setMethod · 0.45

Tested by

no test coverage detected