diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2019-10-26 09:53:38 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-10-26 09:57:05 +0200 |
commit | 7348378a965d25ec0ef8e9f698ad33306031a5e3 (patch) | |
tree | 6c4221398b89d9737314ebf896c180baa15cd814 /lib/core | |
parent | 583f9727880e81b1827cfb33dbbd924589eda33c (diff) |
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>
Diffstat (limited to 'lib/core')
-rw-r--r-- | lib/core/libimagstore/src/store.rs | 4 |
1 files changed, 3 insertions, 1 deletions
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()); |