mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-13 22:26:49 +00:00
Merge remote-tracking branch 'origin/main' into feature/network/multi-network-serving
# Conflicts: # plugins/lookup/email.py # tests/unit/python/roles/web-app-prometheus/test_blackbox_targets.py
This commit is contained in:
commit
1da2cef95e
107 files changed
+2414
-478
No files matched your search
@@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
from cli.meta.ci.report_failures import (
|
||||
Failure,
|
||||
@@ -10,6 +11,7 @@ from cli.meta.ci.report_failures import (
|
||||
decisive_excerpt,
|
||||
failed_roles,
|
||||
issue_body,
|
||||
list_jobs,
|
||||
)
|
||||
|
||||
|
||||
@@ -92,6 +94,19 @@ class TestReportFailures(unittest.TestCase):
|
||||
artifact_name("web-app-x", Failure("compose", "0", "tor", "fedora", "zfs")),
|
||||
)
|
||||
|
||||
def test_list_jobs_reads_one_job_per_line_across_pages(self) -> None:
|
||||
pages = (
|
||||
'{"name": "deploy a", "conclusion": "success"}\n'
|
||||
'{"name": "deploy b", "conclusion": "failure"}\n'
|
||||
)
|
||||
with patch("cli.meta.ci.report_failures._gh", return_value=pages):
|
||||
jobs = list_jobs("1", "owner/repo")
|
||||
self.assertEqual([job["name"] for job in jobs], ["deploy a", "deploy b"])
|
||||
|
||||
def test_list_jobs_of_an_empty_listing_is_empty(self) -> None:
|
||||
with patch("cli.meta.ci.report_failures._gh", return_value=""):
|
||||
self.assertEqual(list_jobs("1", "owner/repo"), [])
|
||||
|
||||
def test_issue_body_lists_failures_and_run(self) -> None:
|
||||
body = issue_body(
|
||||
"web-app-xwiki",
|
||||
|
||||
+18
-2
@@ -9,7 +9,13 @@ import cli.meta.env.__main__ as env_main
|
||||
|
||||
|
||||
class TestDotenvHostOwned(unittest.TestCase):
|
||||
def _run(self, *, dotenv_exists: bool, host_owned: str | None) -> tuple[int, bool]:
|
||||
def _run(
|
||||
self,
|
||||
*,
|
||||
dotenv_exists: bool,
|
||||
host_owned: str | None,
|
||||
argv: list[str] | None = None,
|
||||
) -> tuple[int, bool]:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
(root / "default.env").write_text("INFINITO_DISTRO=debian\n")
|
||||
@@ -28,7 +34,7 @@ class TestDotenvHostOwned(unittest.TestCase):
|
||||
patch.object(env_main, "write_dotenv") as write_dotenv,
|
||||
):
|
||||
build_env.return_value.values = {}
|
||||
rc = env_main.main()
|
||||
rc = env_main.main(argv)
|
||||
return rc, write_dotenv.called
|
||||
|
||||
def test_a_host_owned_dotenv_is_kept(self) -> None:
|
||||
@@ -40,6 +46,16 @@ class TestDotenvHostOwned(unittest.TestCase):
|
||||
def test_without_the_marker_the_dotenv_is_regenerated(self) -> None:
|
||||
self.assertEqual(self._run(dotenv_exists=True, host_owned=None), (0, True))
|
||||
|
||||
def test_an_explicit_output_is_written_even_when_host_owned(self) -> None:
|
||||
self.assertEqual(
|
||||
self._run(
|
||||
dotenv_exists=True,
|
||||
host_owned="true",
|
||||
argv=["--output", "/nonexistent/distro.env"],
|
||||
),
|
||||
(0, True),
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__": # pragma: no cover
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user