fix regression tests

This commit is contained in:
Dietmar Maurer 2021-09-10 12:45:06 +02:00
parent 6227654ad8
commit 67a5cf4714
6 changed files with 22 additions and 40 deletions

View File

@ -22,15 +22,12 @@ pub const FILENAME_FORMAT: ApiStringFormat = ApiStringFormat::VerifyFn(|name| {
}); });
// Complex type definitions
// Regression tests // Regression tests
#[test] #[test]
fn test_cert_fingerprint_schema() -> Result<(), anyhow::Error> { fn test_cert_fingerprint_schema() -> Result<(), anyhow::Error> {
let schema = CERT_FINGERPRINT_SHA256_SCHEMA; let schema = pbs_api_types::CERT_FINGERPRINT_SHA256_SCHEMA;
let invalid_fingerprints = [ let invalid_fingerprints = [
"86:88:7c:be:26:77:a5:62:67:d9:06:f5:e4::61:3e:20:dc:cd:43:92:07:7f:fb:65:54:6c:ff:d2:96:36:f8", "86:88:7c:be:26:77:a5:62:67:d9:06:f5:e4::61:3e:20:dc:cd:43:92:07:7f:fb:65:54:6c:ff:d2:96:36:f8",
@ -70,6 +67,9 @@ fn test_cert_fingerprint_schema() -> Result<(), anyhow::Error> {
#[test] #[test]
fn test_proxmox_user_id_schema() -> Result<(), anyhow::Error> { fn test_proxmox_user_id_schema() -> Result<(), anyhow::Error> {
use pbs_api_types::Userid;
let invalid_user_ids = [ let invalid_user_ids = [
"x", // too short "x", // too short
"xx", // too short "xx", // too short

View File

@ -6,17 +6,9 @@ use std::path::PathBuf;
use anyhow::Error; use anyhow::Error;
use pbs_systemd::time::parse_time_span; use pbs_systemd::time::parse_time_span;
use pbs_api_types::{RetentionPolicy, MediaSetPolicy};
use crate::{ use crate::tape::{Inventory, MediaPool};
api2::types::{
MediaSetPolicy,
RetentionPolicy,
},
tape::{
Inventory,
MediaPool,
},
};
fn create_testdir(name: &str) -> Result<PathBuf, Error> { fn create_testdir(name: &str) -> Result<PathBuf, Error> {
let mut testdir: PathBuf = String::from("./target/testout").into(); let mut testdir: PathBuf = String::from("./target/testout").into();

View File

@ -9,18 +9,13 @@ use proxmox::tools::{
Uuid, Uuid,
}; };
use crate::{ use pbs_api_types::{MediaStatus, MediaSetPolicy, RetentionPolicy};
api2::types::{
MediaStatus, use crate::tape::{
MediaSetPolicy, Inventory,
RetentionPolicy, MediaPool,
}, file_formats::{
tape::{ MediaSetLabel,
Inventory,
MediaPool,
file_formats::{
MediaSetLabel,
},
}, },
}; };

View File

@ -5,19 +5,14 @@
use std::path::PathBuf; use std::path::PathBuf;
use anyhow::Error; use anyhow::Error;
use proxmox::tools::{ use proxmox::tools::Uuid;
Uuid,
}; use pbs_api_types::{RetentionPolicy, MediaSetPolicy};
use crate::{ use crate::{
api2::types::{
MediaSetPolicy,
RetentionPolicy,
},
tape::{ tape::{
Inventory, Inventory,
MediaPool, MediaPool,
file_formats::{ file_formats::{
MediaSetLabel, MediaSetLabel,
}, },

View File

@ -9,11 +9,9 @@ use proxmox::tools::{
Uuid, Uuid,
}; };
use pbs_api_types::{MediaLocation, MediaStatus};
use crate::{ use crate::{
api2::types::{
MediaLocation,
MediaStatus,
},
tape::{ tape::{
Inventory, Inventory,
file_formats::{ file_formats::{

View File

@ -8,6 +8,8 @@ extern crate nix;
use proxmox::try_block; use proxmox::try_block;
use pbs_api_types::{Authid, UPID};
use proxmox_backup::server; use proxmox_backup::server;
use proxmox_backup::tools; use proxmox_backup::tools;
@ -59,7 +61,7 @@ fn worker_task_abort() -> Result<(), Error> {
let res = server::WorkerTask::new_thread( let res = server::WorkerTask::new_thread(
"garbage_collection", "garbage_collection",
None, None,
proxmox_backup::api2::types::Authid::root_auth_id().clone(), Authid::root_auth_id().clone(),
true, true,
move |worker| { move |worker| {
println!("WORKER {}", worker); println!("WORKER {}", worker);
@ -84,7 +86,7 @@ fn worker_task_abort() -> Result<(), Error> {
} }
Ok(wid) => { Ok(wid) => {
println!("WORKER: {}", wid); println!("WORKER: {}", wid);
server::abort_worker_async(wid.parse::<server::UPID>().unwrap()); server::abort_worker_async(wid.parse::<UPID>().unwrap());
} }
} }
}); });