mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-28 22:06:31 +00:00
Merge branch 'main' into feature/designer
# Conflicts: # roles/web-app-suitecrm/files/session.yaml # roles/web-app-suitecrm/meta/volumes.yml
This commit is contained in:
commit
8c82e5262e
42 files changed
+829
-120
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,
|
||||
)
|
||||
|
||||
|
||||
@@ -80,6 +82,19 @@ class TestReportFailures(unittest.TestCase):
|
||||
artifact_name("web-app-x", Failure("compose", "0", True, "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",
|
||||
|
||||
Whitespace-only changes.
+45
@@ -0,0 +1,45 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
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]:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
(root / "default.env").write_text("INFINITO_DISTRO=debian\n")
|
||||
if dotenv_exists:
|
||||
(root / ".env").write_text("INFINITO_RUNNING_ON_GITHUB=true\n")
|
||||
environ = (
|
||||
{} if host_owned is None else {env_main.HOST_OWNED_KEY: host_owned}
|
||||
)
|
||||
with (
|
||||
patch.object(env_main, "REPO_ROOT", root),
|
||||
patch.dict("os.environ", environ, clear=True),
|
||||
patch.object(
|
||||
env_main, "parse_static_env_with_comments", return_value=({}, {})
|
||||
),
|
||||
patch.object(env_main, "build_env") as build_env,
|
||||
patch.object(env_main, "write_dotenv") as write_dotenv,
|
||||
):
|
||||
build_env.return_value.values = {}
|
||||
rc = env_main.main()
|
||||
return rc, write_dotenv.called
|
||||
|
||||
def test_a_host_owned_dotenv_is_kept(self) -> None:
|
||||
self.assertEqual(self._run(dotenv_exists=True, host_owned="true"), (0, False))
|
||||
|
||||
def test_a_missing_dotenv_is_generated_even_when_host_owned(self) -> None:
|
||||
self.assertEqual(self._run(dotenv_exists=False, host_owned="true"), (0, True))
|
||||
|
||||
def test_without_the_marker_the_dotenv_is_regenerated(self) -> None:
|
||||
self.assertEqual(self._run(dotenv_exists=True, host_owned=None), (0, True))
|
||||
|
||||
|
||||
if __name__ == "__main__": # pragma: no cover
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user