mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-24 04:57:00 +01:00
fmt
This commit is contained in:
parent
98e118d488
commit
81d61df9f7
|
@ -386,12 +386,12 @@ impl BackendWriteTransaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn backup(&self, audit: &mut AuditScope, dstPath: &str) -> Result<(), OperationError> {
|
pub fn backup(&self, audit: &mut AuditScope, dstPath: &str) -> Result<(), OperationError> {
|
||||||
|
|
||||||
//open connection to the destination
|
//open connection to the destination
|
||||||
let result = self.conn.backup(rusqlite::DatabaseName::Main, dstPath, None);
|
let result = self
|
||||||
|
.conn
|
||||||
|
.backup(rusqlite::DatabaseName::Main, dstPath, None);
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
|
|
||||||
Ok(_) => Ok(()),
|
Ok(_) => Ok(()),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
audit_log!(audit, "Error in sqlite {:?}", e);
|
audit_log!(audit, "Error in sqlite {:?}", e);
|
||||||
|
@ -765,26 +765,20 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_backup_restore() {
|
fn test_backup_restore() {
|
||||||
|
|
||||||
run_test!(|audit: &mut AuditScope, be: &BackendWriteTransaction| {
|
run_test!(|audit: &mut AuditScope, be: &BackendWriteTransaction| {
|
||||||
|
|
||||||
let result = fs::remove_file(dbBackupFileName);
|
let result = fs::remove_file(dbBackupFileName);
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
|
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
||||||
// if the error is the file is not found, thats what we want so continue,
|
// if the error is the file is not found, thats what we want so continue,
|
||||||
// otherwise return the error
|
// otherwise return the error
|
||||||
match e.kind() {
|
match e.kind() {
|
||||||
std::io::ErrorKind::NotFound => {},
|
std::io::ErrorKind::NotFound => {}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
be.backup(audit, "./.backup_test.db").unwrap();
|
be.backup(audit, "./.backup_test.db").unwrap();
|
||||||
be.restore(audit).unwrap();
|
be.restore(audit).unwrap();
|
||||||
|
|
Loading…
Reference in a new issue