mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-10 12:47:04 +00:00
py/unused-import on PR #625 (mirror/model.py:10): the module only re-imported ImageRef from utils.docker.image.discovery. providers.py and the four mirror tests import it from there, as wait/__main__.py already did; no other importer exists. 🎯 Fix: 97 % 💥 Break: 2 % 💸 Cost: – ⏱️ Time: – 🛡️ Security: ~100 % 🏆 Score: 95 🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
57 lines
1.6 KiB
Python
57 lines
1.6 KiB
Python
from __future__ import annotations
|
|
|
|
import unittest
|
|
from unittest.mock import patch
|
|
|
|
import cli.contributing.mirror.wait.__main__ as wait_main
|
|
from utils.docker.image.discovery import ImageRef
|
|
|
|
|
|
class TestMirrorWait(unittest.TestCase):
|
|
def test_a_missing_runner_mirror_keeps_the_wait_open(self) -> None:
|
|
image = ImageRef(
|
|
role="runner",
|
|
service="coredns",
|
|
name="coredns/coredns",
|
|
version="1.14.4",
|
|
source="docker.io/coredns/coredns:1.14.4",
|
|
registry="docker.io",
|
|
source_file="compose.yml",
|
|
)
|
|
|
|
with (
|
|
patch(
|
|
"cli.contributing.mirror.wait.__main__.iter_role_images",
|
|
return_value=[],
|
|
),
|
|
patch(
|
|
"cli.contributing.mirror.wait.__main__.iter_runner_images",
|
|
return_value=[image],
|
|
),
|
|
patch.object(
|
|
wait_main.GHCRProvider, "tag_exists", return_value=False
|
|
) as tag_exists,
|
|
patch(
|
|
"sys.argv",
|
|
[
|
|
"mirror-wait",
|
|
"--ghcr-namespace",
|
|
"acme",
|
|
"--ghcr-repository",
|
|
"myrepo",
|
|
"--attempts",
|
|
"1",
|
|
"--sleep-seconds",
|
|
"1",
|
|
],
|
|
),
|
|
):
|
|
result = wait_main.main()
|
|
|
|
self.assertEqual(result, 1)
|
|
tag_exists.assert_called_once_with(image)
|
|
|
|
|
|
if __name__ == "__main__": # pragma: no cover
|
|
unittest.main()
|