Remove only some of the data.
(mock_redis_cache)
| 283 | |
| 284 | |
| 285 | def test_remove_remaining(mock_redis_cache): |
| 286 | """ |
| 287 | Remove only some of the data. |
| 288 | """ |
| 289 | redis_server = redis_cache.__context__["cache.redis"]["client"] |
| 290 | |
| 291 | redis_cache.store("minions/myhost", "grain", {"os": "Linux"}) |
| 292 | redis_cache.store("minions/myhost", "pillar", {"os": "Linux"}) |
| 293 | redis_cache.flush("minions/myhost", "pillar") |
| 294 | |
| 295 | expected = { |
| 296 | "$BANKS_": {"type": "sortedset", "data": {b"$KEYS_minions/myhost/": 0}}, |
| 297 | "$KEYS_minions/myhost/": { |
| 298 | "type": "hash", |
| 299 | "data": {b"grain": b"\x81\xa2os\xa5Linux"}, |
| 300 | }, |
| 301 | "$TSTAMP_minions/myhost/": {"type": "hash", "data": {b"grain": b"\x00"}}, |
| 302 | } |
| 303 | assert expected == redis_server.db |
| 304 | |
| 305 | |
| 306 | def test_flush_bank(mock_redis_cache): |