MCPcopy Create free account
hub / github.com/saltstack/salt / test_remove_remaining

Function test_remove_remaining

tests/pytests/unit/cache/test_redis_cache.py:285–303  ·  view source on GitHub ↗

Remove only some of the data.

(mock_redis_cache)

Source from the content-addressed store, hash-verified

283
284
285def 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
306def test_flush_bank(mock_redis_cache):

Callers

nothing calls this directly

Calls 2

storeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected