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
#[test]
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 = [
"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]
fn test_proxmox_user_id_schema() -> Result<(), anyhow::Error> {
use pbs_api_types::Userid;
let invalid_user_ids = [
"x", // too short
"xx", // too short

View File

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

View File

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

View File

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

View File

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

View File

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