mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 11:46:35 +00:00
refactor(ci): group the rescue helpers under scripts/tests/deploy/utils/rescue
2bf329cd3b put rescue_window.sh next to rescue_index.sh, and
test_prefix_grouped_files rejects two siblings sharing the `rescue`
prefix (quality-high pass 67). Both move to utils/rescue/ as index.sh and
window.sh, their tests to the mirrored tests/.../utils/rescue/, and every
caller follows: dedicated.sh, the swarm teardown in 00_one.sh, the
workspace workflow, and the swarm and diagnostics READMEs.
The budget-kill drill gave the stand-in a 1 s budget; under the full
parallel unit run the SIGTERM arrived before its EXIT trap was installed,
so nothing was captured and the test failed. The two kill drills now use
KILL_BUDGET = 3 s; their assertions are unchanged. A full `make test-unit`
passes them under load.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2bf329cd3b
commit
8a0e858f12
10 files changed
+16
-15
No files matched your search
Whitespace-only changes.
+2
-2
@@ -1,6 +1,6 @@
|
||||
"""The caller contract of the rescue-artifact index.
|
||||
|
||||
``rescue_index.sh`` runs inside cleanup handlers and in a GitHub step under
|
||||
``rescue/index.sh`` runs inside cleanup handlers and in a GitHub step under
|
||||
``bash -e`` with no fallback, so its exit status decides whether the caller
|
||||
finishes tearing down: a fatal usage error and a ``find`` that rejects
|
||||
``-printf`` both have to leave the caller at rc 0, and the latter has to stay
|
||||
@@ -21,7 +21,7 @@ from pathlib import Path
|
||||
|
||||
from utils.cache.files import PROJECT_ROOT
|
||||
|
||||
INDEX = PROJECT_ROOT / "scripts" / "tests" / "deploy" / "utils" / "rescue_index.sh"
|
||||
INDEX = PROJECT_ROOT / "scripts" / "tests" / "deploy" / "utils" / "rescue" / "index.sh"
|
||||
FIND_WITHOUT_PRINTF = '#!/bin/sh\necho "find: unrecognized: -printf" >&2\nexit 1\n'
|
||||
GLYPHS = ("📁", "📄", "📜", "🧾")
|
||||
FIND_CUT_SHORT = (
|
||||
+6
-5
@@ -13,12 +13,13 @@ from pathlib import Path
|
||||
from utils.cache.files import PROJECT_ROOT, read_text
|
||||
|
||||
DEPLOY = PROJECT_ROOT / "scripts" / "tests" / "deploy"
|
||||
HELPER = DEPLOY / "utils" / "rescue_window.sh"
|
||||
INDEX = DEPLOY / "utils" / "rescue_index.sh"
|
||||
HELPER = DEPLOY / "utils" / "rescue" / "window.sh"
|
||||
INDEX = DEPLOY / "utils" / "rescue" / "index.sh"
|
||||
DEDICATED = DEPLOY / "ci" / "dedicated.sh"
|
||||
COLLECTOR = PROJECT_ROOT / "utils" / "diagnostics" / "container.py"
|
||||
DISTRO_PREFIX = "INFINITO_CI_DISTRO_" # nocheck: prefix the drills strip, not a key
|
||||
GRACE = 8
|
||||
KILL_BUDGET = 3
|
||||
SKIPPED = b"[skipped: past RESCUE_DEADLINE]\n"
|
||||
|
||||
WINDOW = """\
|
||||
@@ -114,7 +115,7 @@ class RescueWindowTests(unittest.TestCase):
|
||||
class DedicatedWiringTests(unittest.TestCase):
|
||||
def test_every_capture_runs_inside_the_window(self) -> None:
|
||||
text = read_text(str(DEDICATED))
|
||||
self.assertIn("utils/rescue_window.sh", text)
|
||||
self.assertIn("utils/rescue/window.sh", text)
|
||||
self.assertIn("rescue_window 1500", text)
|
||||
self.assertIn("rescue_window 900", text)
|
||||
commands = text.replace("\\\n", " ").replace('"', "").splitlines()
|
||||
@@ -172,7 +173,7 @@ class BudgetKillDrillTests(unittest.TestCase):
|
||||
|
||||
def test_a_budget_kill_copies_a_partial_snapshot_out_inside_the_grace(self) -> None:
|
||||
proc, kill_epoch, rescued, files = self._drill(
|
||||
"sleep", "1000", budget=1, journal_seconds="30", epochs=True
|
||||
"sleep", "1000", budget=KILL_BUDGET, journal_seconds="30", epochs=True
|
||||
)
|
||||
self.assertEqual(proc.returncode, 124, proc.stdout)
|
||||
self.assertIn("Budget kill:", proc.stdout)
|
||||
@@ -185,7 +186,7 @@ class BudgetKillDrillTests(unittest.TestCase):
|
||||
|
||||
def test_without_the_window_the_kill_lands_before_the_copy(self) -> None:
|
||||
proc, _kill_epoch, rescued, files = self._drill(
|
||||
"sleep", "1000", budget=1, journal_seconds="30", epochs=False
|
||||
"sleep", "1000", budget=KILL_BUDGET, journal_seconds="30", epochs=False
|
||||
)
|
||||
self.assertEqual(proc.returncode, 137, proc.stdout)
|
||||
self.assertIsNone(rescued)
|
||||
Reference in new issue
Block a user