Confirm deletions that end within the delay and keep the storage colours

- A deletion that Proxmox completes within --delay prints its task log line, Removed volume '<volid>', instead of JSON; that exact line for the requested volume now counts as deleted
- The backup list keeps the green dot and the colour of each storage
- The deletion request waits up to 300 s, the worst case of 20 archives checked and deleted four at a time
This commit is contained in:
MacRimi
2026-10-16 23:48:49 +02:00
parent 7e97bcb25b
commit 63ae1ba68f
5 changed files with 36 additions and 7 deletions
+13
View File
@@ -56,6 +56,19 @@ class DeletionTests(unittest.TestCase):
["delete", f"/nodes/pve1/storage/local/content/{VOLUME}", "--delay", "1"],
])
def test_a_deletion_that_ends_within_the_delay_prints_its_log_and_counts_as_deleted(self):
# Real pvesh output on a directory storage: the task log, not JSON.
run = subprocess.CompletedProcess([], 0, stdout=f"Removed volume '{VOLUME}'\n", stderr="")
with patch.object(archives.subprocess, "run", return_value=run):
self.assertEqual(archives._pvesh(["delete", f"/nodes/pve1/storage/local/content/{VOLUME}", "--delay", "1"]),
f"Removed volume '{VOLUME}'")
self.response = f"Removed volume '{VOLUME}'"
self.assertEqual(self.delete()["results"][0]["status"], "deleted")
self.response = "Removed volume 'local:backup/another-archive.tar.zst'"
self.assertEqual(self.delete()["results"][0]["status"], "unconfirmed")
with patch.object(archives.subprocess, "run", return_value=run), self.assertRaises(archives.BackupArchiveError):
archives._pvesh(["get", "/nodes/pve1/storage/local/content"])
def test_bad_payloads_and_paths_never_reach_proxmox(self):
payloads = [None, [], {}, {"confirm": 1}, {"confirm": True, "backups": []},
{"confirm": True, "backups": [None]}, {"confirm": True, "backups": [VOLUME]},