From 7348378a965d25ec0ef8e9f698ad33306031a5e3 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 26 Oct 2019 09:53:38 +0200 Subject: [PATCH] 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 --- lib/core/libimagstore/src/store.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/core/libimagstore/src/store.rs b/lib/core/libimagstore/src/store.rs index 1e195fb0..24b57052 100644 --- a/lib/core/libimagstore/src/store.rs +++ b/lib/core/libimagstore/src/store.rs @@ -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());