mirror of
https://github.com/kevinveenbirkenbach/docker-volume-backup-cleanup.git
synced 2026-01-08 16:32:13 +00:00
test(e2e): add docker-based end-to-end coverage for --backups-root and --force-keep
- Run E2E suite via unittest discovery inside the container - Add E2E test for --id mode with real filesystem + fake dirval - Add E2E test for --all + --force-keep to ensure latest backups are skipped https://chatgpt.com/share/6954d89e-bf08-800f-be4a-5d237d190ddd
This commit is contained in:
@@ -153,6 +153,36 @@ class CleanupBackupsUsingDirvalTests(unittest.TestCase):
|
||||
self.assertFalse(self.timeoutC.exists())
|
||||
self.assertTrue(self.goodX.exists())
|
||||
self.assertFalse(self.badY.exists())
|
||||
|
||||
def test_all_mode_force_keep_skips_last_backup_folder(self):
|
||||
# Given backup folders: ID1, ID2 (sorted)
|
||||
# --force-keep 1 should skip ID2 completely.
|
||||
rc, out, err, _ = self.run_main(
|
||||
[
|
||||
"--backups-root",
|
||||
str(self.backups_root),
|
||||
"--all",
|
||||
"--force-keep",
|
||||
"1",
|
||||
"--dirval-cmd",
|
||||
str(self.dirval),
|
||||
"--workers",
|
||||
"4",
|
||||
"--timeout",
|
||||
SHORT_TIMEOUT,
|
||||
"--yes",
|
||||
]
|
||||
)
|
||||
self.assertEqual(rc, 0, msg=err or out)
|
||||
|
||||
# ID1 should be processed
|
||||
self.assertTrue(self.goodA.exists())
|
||||
self.assertFalse(self.badB.exists())
|
||||
self.assertFalse(self.timeoutC.exists())
|
||||
|
||||
# ID2 should be untouched
|
||||
self.assertTrue(self.goodX.exists())
|
||||
self.assertTrue(self.badY.exists())
|
||||
|
||||
def test_dirval_missing_errors(self):
|
||||
rc, out, err, _ = self.run_main(
|
||||
|
||||
Reference in New Issue
Block a user