mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 19:56:53 +00:00
Merge branch 'main' into feature/store-i18n
This commit is contained in:
342 files changed
+7444
-1661
No files matched your search
@@ -113,6 +113,7 @@ class TestArtifactSlug(unittest.TestCase):
|
||||
entry["distro"],
|
||||
entry["filesystem"],
|
||||
entry["architecture"],
|
||||
entry["vpn"] == "true",
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -224,7 +225,7 @@ class TestPriorityCoverage(unittest.TestCase):
|
||||
def test_an_incapable_priority_variant_skips_its_onion_runs(self) -> None:
|
||||
rows = [_row("web-app-a", 1, ("compose", "swarm"), priority=True)]
|
||||
entries = _assign(rows, sweep=0, tor_mode="auto", variants_per_app=_VARIANTS)
|
||||
self.assertEqual([e["tor"] for e in entries], ["false", "false"])
|
||||
self.assertEqual({e["tor"] for e in entries}, {"false"})
|
||||
|
||||
|
||||
class TestAssign(unittest.TestCase):
|
||||
@@ -324,6 +325,29 @@ class TestAssign(unittest.TestCase):
|
||||
self.assertNotIn("false", [e["tor"] for e in entries])
|
||||
|
||||
|
||||
class TestMeshRotation(unittest.TestCase):
|
||||
_ROWS = tuple(_row("web-app-b", 0, ("compose", "swarm")) for _ in range(8))
|
||||
|
||||
def _entries(self, sweep: int) -> list[dict[str, str]]:
|
||||
return _assign(
|
||||
self._ROWS, sweep=sweep, tor_mode="auto", variants_per_app=_VARIANTS
|
||||
)
|
||||
|
||||
def test_every_sweep_lands_swarm_rows_on_both_arms(self) -> None:
|
||||
for sweep in range(8):
|
||||
with self.subTest(sweep=sweep):
|
||||
arms = {e["vpn"] for e in self._entries(sweep) if e["mode"] == "swarm"}
|
||||
self.assertEqual(arms, {"true", "false"})
|
||||
|
||||
def test_a_compose_row_never_carries_the_mesh(self) -> None:
|
||||
for sweep in range(8):
|
||||
with self.subTest(sweep=sweep):
|
||||
arms = {
|
||||
e["vpn"] for e in self._entries(sweep) if e["mode"] == "compose"
|
||||
}
|
||||
self.assertEqual(arms, {"false"})
|
||||
|
||||
|
||||
class TestPinnedAxes(unittest.TestCase):
|
||||
def _entries(self, row: dict) -> list[dict[str, str]]:
|
||||
return _assign([row], sweep=0, tor_mode="auto", variants_per_app=_VARIANTS)
|
||||
@@ -373,9 +397,30 @@ class TestPinnedAxes(unittest.TestCase):
|
||||
priority=True,
|
||||
pin_mode="swarm",
|
||||
pin_tor=False,
|
||||
pin_vpn=False,
|
||||
)
|
||||
self.assertEqual(len(self._entries(row)), 1)
|
||||
|
||||
def test_a_held_mesh_axis_overrides_a_priority_rows_pin(self) -> None:
|
||||
row = _row(
|
||||
"web-app-b", 0, ("swarm",), priority=True, pin_mode="swarm", pin_vpn=False
|
||||
)
|
||||
entries = _assign(
|
||||
[row],
|
||||
sweep=0,
|
||||
tor_mode="auto",
|
||||
variants_per_app=_VARIANTS,
|
||||
vpn_mode="enforced",
|
||||
)
|
||||
self.assertNotEqual(entries, [])
|
||||
self.assertEqual({e["vpn"] for e in entries}, {"true"})
|
||||
|
||||
def test_a_priority_rows_pin_still_narrows_a_rotating_axis(self) -> None:
|
||||
row = _row(
|
||||
"web-app-b", 0, ("swarm",), priority=True, pin_mode="swarm", pin_vpn=False
|
||||
)
|
||||
self.assertEqual({e["vpn"] for e in self._entries(row)}, {"false"})
|
||||
|
||||
def test_an_unoffered_mode_aborts_the_matrix(self) -> None:
|
||||
row = _row("web-app-b", 0, ("compose",), pin_mode="swarm")
|
||||
with self.assertRaises(SystemExit):
|
||||
@@ -449,7 +494,13 @@ class TestDistroAndFilesystemAxes(unittest.TestCase):
|
||||
def test_a_priority_row_spreads_its_combinations_over_the_pool(self) -> None:
|
||||
rows = [_row("web-app-b", 0, ("compose", "swarm"), priority=True)]
|
||||
entries = _assign(rows, sweep=0, tor_mode="auto", variants_per_app=_VARIANTS)
|
||||
self.assertEqual(len({e["distro"] for e in entries}), len(entries))
|
||||
self.assertEqual(
|
||||
len({e["distro"] for e in entries}),
|
||||
min(len(entries), len(axes.DISTROS)),
|
||||
"a priority row must walk the pool, not repeat one distribution; "
|
||||
"once it has more combinations than the pool has members, the "
|
||||
"rotation wraps and every distribution is proven at least once",
|
||||
)
|
||||
|
||||
def test_a_pinned_distro_replaces_the_rotation(self) -> None:
|
||||
rows = [_row("web-app-b", 0, ("compose",), pin_distro="fedora")]
|
||||
@@ -505,6 +556,7 @@ class TestDistroAndFilesystemAxes(unittest.TestCase):
|
||||
entry["label"].startswith(
|
||||
to_emoji("compose")
|
||||
+ to_emoji("clearnet")
|
||||
+ to_emoji("direct")
|
||||
+ to_emoji("debian")
|
||||
+ to_emoji("zfs")
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user