also test abort_restore
This commit is contained in:
parent
756b7a3e67
commit
ff17174cf1
@ -296,7 +296,7 @@ impl Service {
|
|||||||
fn replace_client_db(&self) -> Result<(), Error> {
|
fn replace_client_db(&self) -> Result<(), Error> {
|
||||||
let our_db = self.restoration_db();
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,12 +517,6 @@ impl SnapshotService for Service {
|
|||||||
fn abort_restore(&self) {
|
fn abort_restore(&self) {
|
||||||
*self.restoration.lock() = None;
|
*self.restoration.lock() = None;
|
||||||
*self.status.lock() = RestorationStatus::Inactive;
|
*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) {
|
fn restore_state_chunk(&self, hash: H256, chunk: Bytes) {
|
||||||
|
@ -129,13 +129,15 @@ fn guards_delete_folders() {
|
|||||||
state_root: Default::default(),
|
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());
|
assert!(path.exists());
|
||||||
|
|
||||||
drop(service);
|
drop(service);
|
||||||
|
|
||||||
assert!(!path.exists());
|
assert!(!path.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
Loading…
Reference in New Issue
Block a user