Skip to content
Snippets Groups Projects
Verified Commit fe93034f authored by David Runge's avatar David Runge :chipmunk:
Browse files

test(nethsm/tests/config.rs): Fix create_backup test

Use the admin user credentials before calling the `restore` function,
which allows for the restore to succeed.

Fixes #8



Signed-off-by: default avatarDavid Runge <dvzrv@archlinux.org>
parent 1741f08d
No related branches found
No related tags found
1 merge request!22fix(deps): update rust crate nethsm-sdk-rs to v1.1.0
......@@ -8,6 +8,7 @@ use common::{
unprovisioned_nethsm,
update_file,
NetHsmImage,
ADMIN_USER_ID,
BACKUP_PASSPHRASE,
BACKUP_USER_ID,
BACKUP_USER_PASSPHRASE,
......@@ -211,17 +212,13 @@ async fn create_backup(
std::fs::write(&backup_file, backup.clone())?;
println!("Written NetHSM backup file: {:?}", &backup_file);
// restore from backup is broken
assert!(
nethsm
.restore(
Passphrase::new(BACKUP_PASSPHRASE.to_string()),
Utc::now(),
std::fs::read(backup_file)?,
)
.is_err(),
"Restore from backup works again: https://github.com/Nitrokey/nethsm/issues/5"
);
// use the admin user again for the restore call
nethsm.use_credentials(ADMIN_USER_ID)?;
nethsm.restore(
Passphrase::new(BACKUP_PASSPHRASE.to_string()),
Utc::now(),
std::fs::read(backup_file)?,
)?;
Ok(())
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment