Fix: In-Memory test backend: Actually remove the old entry on "move"
This fixes a really ugly bug where the in-memory backend for the store
did not remove the entry from the in-memory hashmap on "move", but
simply copied it from the old location to the new one.
That caused tests to fail after the fixes introduced for the
Store::get() function which checked the filesystem and the internal
cache whether an entry exists before the actual "get" operation, because
an old entry would still exist after a move (only in the testcases).
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Fixes: 09e8619cf5
("libimagstore: Move from error-chain to failure")
This commit is contained in:
parent
daaa4fd9ca
commit
becfcd4180
1 changed files with 1 additions and 1 deletions
|
@ -140,7 +140,7 @@ impl FileAbstraction for InMemoryFileAbstraction {
|
||||||
let mut mtx = self.backend().lock().expect("Locking Mutex failed");
|
let mut mtx = self.backend().lock().expect("Locking Mutex failed");
|
||||||
let backend = mtx.get_mut();
|
let backend = mtx.get_mut();
|
||||||
|
|
||||||
let a = backend.get(from).cloned().ok_or_else(|| EM::FileNotFound)?;
|
let a = backend.remove(from).ok_or_else(|| EM::FileNotFound)?;
|
||||||
backend.insert(to.clone(), a);
|
backend.insert(to.clone(), a);
|
||||||
debug!("Renaming: {:?} -> {:?} worked", from, to);
|
debug!("Renaming: {:?} -> {:?} worked", from, to);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue