Fix test: Check whether in cache, then get, then check again

After moving an entry, the entry should _not_ be in the cache. This is
just a decision that has to be made, whether we cache the moved entry or
not. I decided to not cache because it is results in less code.

After that check, we get the entry from the backend and then we can
check whether the entry is in the cache, which is then should be.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2019-10-26 09:53:38 +02:00
parent 583f972788
commit 7348378a96

View file

@ -1212,7 +1212,9 @@ mod store_tests {
assert!(r.map_err(|e| debug!("ERROR: {:?}", e)).is_ok());
{
assert!(store.entries.read().unwrap().get(&id_mv).is_some());
assert!(store.entries.read().unwrap().get(&id_mv).is_none()); // entry not in cache yet
assert!(store.get(id_mv.clone()).unwrap().is_some()); // get entry from backend
assert!(store.entries.read().unwrap().get(&id_mv).is_some()); // entry in cache
}
let res = store.get(id.clone());