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)
| 148 | |
| 149 | @pytest.fixture() |
| 150 | def 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 | |
| 174 | def get_mocked_redis_client( |
nothing calls this directly
no test coverage detected