From 659da6c957a8bfff72766c77e667d265ab38a83f Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 5 Dec 2019 16:47:08 +0100 Subject: [PATCH] tests/prune_data: removed, build list manually --- tests/prune.rs | 26 ++++++++++++++++--- .../elsa/2019-12-02T11:59:15Z/index.json.blob | 0 .../elsa/2019-12-03T11:59:15Z/index.json.blob | 0 .../elsa/2019-12-04T11:59:15Z/index.json.blob | 0 .../elsa/2019-12-04T12:59:15Z/index.json.blob | 0 5 files changed, 23 insertions(+), 3 deletions(-) delete mode 100644 tests/prune_data/simple1/host/elsa/2019-12-02T11:59:15Z/index.json.blob delete mode 100644 tests/prune_data/simple1/host/elsa/2019-12-03T11:59:15Z/index.json.blob delete mode 100644 tests/prune_data/simple1/host/elsa/2019-12-04T11:59:15Z/index.json.blob delete mode 100644 tests/prune_data/simple1/host/elsa/2019-12-04T12:59:15Z/index.json.blob diff --git a/tests/prune.rs b/tests/prune.rs index 46101608..2648930f 100644 --- a/tests/prune.rs +++ b/tests/prune.rs @@ -3,8 +3,6 @@ use std::path::PathBuf; use proxmox_backup::backup::*; -const TESTDIR: &str = "./tests/prune_data/simple1"; - fn get_prune_list( list: Vec, keep_last: Option, @@ -31,11 +29,33 @@ fn get_prune_list( .collect() } +fn create_info( + snapshot: &str, + partial: bool, +) -> BackupInfo { + + let backup_dir = BackupDir::parse(snapshot).unwrap(); + + let mut files = Vec::new(); + + if !partial { + files.push(String::from(MANIFEST_BLOB_NAME)); + } + + BackupInfo { backup_dir, files } +} + #[test] fn test_prune_simple() -> Result<(), Error> { - let orig_list = BackupInfo::list_backups(std::path::Path::new(TESTDIR))?; + let mut orig_list = Vec::new(); + orig_list.push(create_info("host/elsa/2019-12-02T11:59:15Z", false)); + orig_list.push(create_info("host/elsa/2019-12-03T11:59:15Z", false)); + orig_list.push(create_info("host/elsa/2019-12-04T11:59:15Z", false)); + orig_list.push(create_info("host/elsa/2019-12-04T12:59:15Z", false)); + + // keep-last tests let list = orig_list.clone(); diff --git a/tests/prune_data/simple1/host/elsa/2019-12-02T11:59:15Z/index.json.blob b/tests/prune_data/simple1/host/elsa/2019-12-02T11:59:15Z/index.json.blob deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/prune_data/simple1/host/elsa/2019-12-03T11:59:15Z/index.json.blob b/tests/prune_data/simple1/host/elsa/2019-12-03T11:59:15Z/index.json.blob deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/prune_data/simple1/host/elsa/2019-12-04T11:59:15Z/index.json.blob b/tests/prune_data/simple1/host/elsa/2019-12-04T11:59:15Z/index.json.blob deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/prune_data/simple1/host/elsa/2019-12-04T12:59:15Z/index.json.blob b/tests/prune_data/simple1/host/elsa/2019-12-04T12:59:15Z/index.json.blob deleted file mode 100644 index e69de29b..00000000