(client)
| 218 | |
| 219 | @pytest.mark.redismod |
| 220 | def test_create_and_delete_rule(client): |
| 221 | # test rule creation |
| 222 | time = 100 |
| 223 | client.ts().create(1) |
| 224 | client.ts().create(2) |
| 225 | client.ts().createrule(1, 2, "avg", 100) |
| 226 | for i in range(50): |
| 227 | client.ts().add(1, time + i * 2, 1) |
| 228 | client.ts().add(1, time + i * 2 + 1, 2) |
| 229 | client.ts().add(1, time * 2, 1.5) |
| 230 | assert round(client.ts().get(2)[1], 5) == 1.5 |
| 231 | info = client.ts().info(1) |
| 232 | if is_resp2_connection(client): |
| 233 | assert info.rules[0][1] == 100 |
| 234 | else: |
| 235 | assert info["rules"]["2"][0] == 100 |
| 236 | |
| 237 | # test rule deletion |
| 238 | client.ts().deleterule(1, 2) |
| 239 | info = client.ts().info(1) |
| 240 | assert not info["rules"] |
| 241 | |
| 242 | |
| 243 | @pytest.mark.redismod |
nothing calls this directly
no test coverage detected