mirror of
https://github.com/kevinveenbirkenbach/docker-volume-backup.git
synced 2026-07-17 06:05:13 +00:00
feat(backup)!: exact --images-* matching and --hard-restart-projects
Match --images-no-stop-required and --images-no-backup-required against the container's exact .Config.Image instead of a substring, so callers pass full repo:tag references (registry prefix included) and near-miss image names no longer flip the stop/skip decision. Rename the opt-in --hard-compose-restart flag to --hard-restart-projects. The e2e suite pins a SPOT for the DB images and in-container data dirs (postgres:alpine at /var/lib/postgresql, mariadb:latest at /var/lib/mysql) and passes exact image refs to the --images-* flags. BREAKING CHANGE: --images-* now require exact image references, not substrings; --hard-compose-restart is renamed to --hard-restart-projects. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,13 +10,12 @@ class TestRequiresStop(unittest.TestCase):
|
||||
def test_requires_stop_false_when_all_images_are_whitelisted(
|
||||
self, mock_get_image_info, _mock_is_swarm_task
|
||||
):
|
||||
# All containers use images containing allowed substrings
|
||||
mock_get_image_info.side_effect = [
|
||||
"repo/mastodon:v4",
|
||||
"repo/wordpress:latest",
|
||||
]
|
||||
containers = ["c1", "c2"]
|
||||
whitelist = ["mastodon", "wordpress"]
|
||||
whitelist = ["repo/mastodon:v4", "repo/wordpress:latest"]
|
||||
self.assertFalse(requires_stop(containers, whitelist))
|
||||
|
||||
@patch("baudolo.backup.app.get_image_info")
|
||||
@@ -28,9 +27,17 @@ class TestRequiresStop(unittest.TestCase):
|
||||
"repo/nginx:latest",
|
||||
]
|
||||
containers = ["c1", "c2"]
|
||||
whitelist = ["mastodon", "wordpress"]
|
||||
whitelist = ["repo/mastodon:v4", "repo/wordpress:latest"]
|
||||
self.assertTrue(requires_stop(containers, whitelist))
|
||||
|
||||
@patch("baudolo.backup.app.get_image_info")
|
||||
def test_requires_stop_true_on_substring_only_match(
|
||||
self, mock_get_image_info, _mock_is_swarm_task
|
||||
):
|
||||
mock_get_image_info.return_value = "reg:5000/repo/mastodon:v4"
|
||||
self.assertTrue(requires_stop(["c1"], ["mastodon"]))
|
||||
self.assertTrue(requires_stop(["c1"], ["repo/mastodon:v4"]))
|
||||
|
||||
@patch("baudolo.backup.app.get_image_info")
|
||||
def test_requires_stop_true_when_whitelist_empty(
|
||||
self, mock_get_image_info, _mock_is_swarm_task
|
||||
|
||||
Reference in New Issue
Block a user