mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
pull.yml pulls, on the target host, every pinned image of the applications the host deploys, the same closure the update check judges, and lists the images a role builds itself instead. It never touches a container, retries each pull a bounded number of times and fails loudly with the image and the registry error. The update_check filter moves next to the new update_pull filter into plugins/filter/update/, and both read the code pins from one helper. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
import unittest
|
|
|
|
from utils.update_check.common import pinned
|
|
|
|
|
|
def _keys(application_id, services):
|
|
return [key for key, _ in pinned(application_id, {"services": services})]
|
|
|
|
|
|
class TestPinned(unittest.TestCase):
|
|
def test_a_service_with_image_and_version_is_pinned(self):
|
|
services = {"nextcloud": {"image": "nextcloud", "version": "34-fpm-alpine"}}
|
|
self.assertEqual(_keys("web-app-nextcloud", services), ["nextcloud"])
|
|
|
|
def test_a_service_without_version_is_not_pinned(self):
|
|
services = {"proxy": {"image": "nginx"}}
|
|
self.assertEqual(_keys("web-app-nextcloud", services), [])
|
|
|
|
def test_a_service_without_image_is_not_pinned(self):
|
|
services = {"cron": {"version": "34-fpm-alpine", "custom": True}}
|
|
self.assertEqual(_keys("web-app-nextcloud", services), [])
|
|
|
|
def test_a_disabled_service_is_not_pinned(self):
|
|
services = {"talk": {"enabled": "False", "image": "talk", "version": "1"}}
|
|
self.assertEqual(_keys("web-app-nextcloud", services), [])
|
|
|
|
def test_a_shared_service_of_another_role_is_not_pinned(self):
|
|
services = {"redis": {"shared": True, "image": "redis", "version": "8"}}
|
|
self.assertEqual(_keys("web-app-nextcloud", services), [])
|
|
|
|
def test_the_shared_primary_service_is_pinned(self):
|
|
services = {"postgres": {"shared": True, "image": "postgres", "version": "18"}}
|
|
self.assertEqual(_keys("svc-db-postgres", services), ["postgres"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|