mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 03:38:23 +00:00
feat(ci): replay a role's README instructions on its smallest deploy row
The instructions test held a job of its own that picked one random role per run, so a README's Production block was proven roughly once per 265 roles. The replay now rides on a deploy row instead: no extra runner, and every role the sweep touches gets its documented one-command deploy exercised. The row is the role's smallest variant -- fewest services enabled -- because that is the shape the README describes, and it is chosen among the variants the sweep actually deploys, so a row cut as redundant coverage cannot silently drop the role from the test. A role qualifies only when its README carries a Production block and the guide's own mode is one the role runs and tests. The marked entry carries the guide mode in `instructions` and a 📖 in its job title, between the variant number and a priority ⭐. The guide mode is independent of the mode the rotation gave the row: a swarm row still replays in compose. The step runs last in the deploy job, after the swarm teardown, because the replay deploys the role a second time and needs the runner's ports. call-test-instructions.yml, cli.meta.ci.guide_select and the `instructions` dispatch input go with it. `redundant()` moves next to the marker so the chunker, the plan table and the marker share one definition. The plan table trades its 📊 Weight column for 📖 Instructions; nothing read the weight any more, so it leaves the matrix entries too. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
bfde5876ba
commit
7fd495cdfc
22 files changed
+330
-303
No files matched your search
@@ -395,7 +395,6 @@ class TestConfigFromTitle(unittest.TestCase):
|
||||
"filesystem": "ext4",
|
||||
"chunk_gate": "false",
|
||||
"workspace": "true",
|
||||
"instructions": "false",
|
||||
}
|
||||
self.assertEqual(runs.config_from_title(render(dispatched)), dispatched)
|
||||
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import textwrap
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from cli.meta.ci import guide_select
|
||||
from utils.cache.files import PROJECT_ROOT
|
||||
from utils.roles.mapping import ROLE_FILE_META_TESTS
|
||||
from utils.roles.meta_lookup import MetaServicesShapeError, get_role_test_skips
|
||||
|
||||
|
||||
class GuideModeTests(unittest.TestCase):
|
||||
def test_role_without_stack_deploys_in_host_mode(self):
|
||||
self.assertEqual(
|
||||
guide_select._guide_mode(PROJECT_ROOT / "roles" / "svc-storage-nfs-client"),
|
||||
"host",
|
||||
)
|
||||
|
||||
def test_role_with_stack_deploys_in_compose_mode(self):
|
||||
self.assertEqual(
|
||||
guide_select._guide_mode(PROJECT_ROOT / "roles" / "web-app-yourls"),
|
||||
"compose",
|
||||
)
|
||||
|
||||
|
||||
class TestableRolesTests(unittest.TestCase):
|
||||
def test_pool_excludes_roles_whose_guide_mode_is_skipped(self):
|
||||
pool = guide_select._testable_roles()
|
||||
self.assertNotIn("svc-storage-nfs-client", pool)
|
||||
self.assertTrue(pool)
|
||||
|
||||
def test_malformed_tests_yml_fails_selection_loudly(self):
|
||||
with TemporaryDirectory() as tmp:
|
||||
role_dir = Path(tmp) / "web-app-broken"
|
||||
tests_path = role_dir / ROLE_FILE_META_TESTS
|
||||
tests_path.parent.mkdir(parents=True)
|
||||
tests_path.write_text(
|
||||
textwrap.dedent(
|
||||
"""
|
||||
---
|
||||
skip: not-a-list
|
||||
"""
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
with self.assertRaises(MetaServicesShapeError):
|
||||
get_role_test_skips(role_dir, role_name=role_dir.name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -15,6 +15,7 @@ def _entry(
|
||||
identifier: str = "0",
|
||||
covered: str = "0",
|
||||
clone: bool = False,
|
||||
instructions: str = "",
|
||||
) -> dict:
|
||||
return {
|
||||
"apps": app,
|
||||
@@ -23,7 +24,7 @@ def _entry(
|
||||
"tor": "true" if variant == "0" else "false",
|
||||
"disable": "",
|
||||
"priority": "true" if priority else "false",
|
||||
"weight": "42",
|
||||
"instructions": instructions,
|
||||
"id": identifier,
|
||||
"covered": covered,
|
||||
"clone": "true" if clone else "false",
|
||||
@@ -68,6 +69,16 @@ class TestCells(unittest.TestCase):
|
||||
self.assertEqual(rows[0][clone], "")
|
||||
self.assertEqual(rows[-1][clone], to_emoji("clone"))
|
||||
|
||||
def test_the_instructions_column_names_the_mode_the_replay_runs_in(self) -> None:
|
||||
entries = [
|
||||
*_ENTRIES,
|
||||
_entry("web-app-d", "0", "swarm", instructions="compose"),
|
||||
]
|
||||
rows = plan.cells(entries, [_PRIORITY, _REGULAR])
|
||||
column = plan._COLUMNS.index("instructions")
|
||||
self.assertEqual(rows[0][column], "")
|
||||
self.assertEqual(rows[-1][column], to_emoji("compose"))
|
||||
|
||||
def test_the_mode_is_rendered_as_its_glyph(self) -> None:
|
||||
rows = plan.cells(_ENTRIES, [_PRIORITY, _REGULAR])
|
||||
mode = plan._COLUMNS.index("mode")
|
||||
|
||||
Reference in new issue
Block a user