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

Function test_store_multiple

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

Store multiple entries in the cache.

(mock_redis_cache)

Source from the content-addressed store, hash-verified

180
181
182def test_store_multiple(mock_redis_cache):
183 """
184 Store multiple entries in the cache.
185 """
186 redis_server = redis_cache.__context__["cache.redis"]["client"]
187
188 redis_cache.store("minions/myhost", "grain", {"os": "Linux"})
189 redis_cache.store("minions/myhost", "pillar", {"os": "Linux"})
190 redis_cache.store("minions/myhost/vm", "grain", {"os": "Windows"})
191 redis_cache.store("minions/myhost/vm", "pillar", {"os": "Windows"})
192 redis_cache.store("minions/yourhost", "grain", {"os": "MacOS"})
193 redis_cache.store("minions/yourhost", "pillar", {"os": "MacOS"})
194
195 expected = {
196 "$BANKS_": {
197 "type": "sortedset",
198 "data": {
199 b"$KEYS_minions/myhost/": 0,
200 b"$KEYS_minions/myhost/vm/": 0,
201 b"$KEYS_minions/yourhost/": 0,
202 },
203 },
204 "$KEYS_minions/myhost/": {
205 "type": "hash",
206 "data": {
207 b"grain": b"\x81\xa2os\xa5Linux",
208 b"pillar": b"\x81\xa2os\xa5Linux",
209 },
210 },
211 "$TSTAMP_minions/myhost/": {
212 "type": "hash",
213 "data": {
214 b"grain": b"\x00",
215 b"pillar": b"\x00",
216 },
217 },
218 "$KEYS_minions/myhost/vm/": {
219 "type": "hash",
220 "data": {
221 b"grain": b"\x81\xa2os\xa7Windows",
222 b"pillar": b"\x81\xa2os\xa7Windows",
223 },
224 },
225 "$TSTAMP_minions/myhost/vm/": {
226 "type": "hash",
227 "data": {
228 b"grain": b"\x00",
229 b"pillar": b"\x00",
230 },
231 },
232 "$KEYS_minions/yourhost/": {
233 "type": "hash",
234 "data": {
235 b"grain": b"\x81\xa2os\xa5MacOS",
236 b"pillar": b"\x81\xa2os\xa5MacOS",
237 },
238 },
239 "$TSTAMP_minions/yourhost/": {

Callers

nothing calls this directly

Calls 1

storeMethod · 0.45

Tested by

no test coverage detected