also test abort_restore

This commit is contained in:
Robert Habermeier 2016-09-08 12:31:12 +02:00
parent 756b7a3e67
commit ff17174cf1
2 changed files with 8 additions and 12 deletions

View File

@ -296,7 +296,7 @@ impl Service {
fn replace_client_db(&self) -> Result<(), Error> {
let our_db = self.restoration_db();
try!(self.db_restore.restore_db(our_db.to_string_lossy()));
try!(self.db_restore.restore_db(&*our_db.to_string_lossy()));
Ok(())
}
@ -517,12 +517,6 @@ impl SnapshotService for Service {
fn abort_restore(&self) {
*self.restoration.lock() = None;
*self.status.lock() = RestorationStatus::Inactive;
if let Err(e) = fs::remove_dir_all(&self.restoration_dir()) {
match e.kind() {
ErrorKind::NotFound => {},
_ => warn!("encountered error {} while deleting snapshot restoration dir.", e),
}
}
}
fn restore_state_chunk(&self, hash: H256, chunk: Bytes) {

View File

@ -129,13 +129,15 @@ fn guards_delete_folders() {
state_root: Default::default(),
};
service.init_restore(manifest).unwrap();
service.init_restore(manifest.clone()).unwrap();
assert!(path.exists());
service.abort_restore();
assert!(!path.exists());
service.init_restore(manifest.clone()).unwrap();
assert!(path.exists());
drop(service);
assert!(!path.exists());
}
#[test]
}