diff --git a/app/nullius/execution.py b/app/nullius/execution.py index 8e101f13..c4d91267 100644 --- a/app/nullius/execution.py +++ b/app/nullius/execution.py @@ -260,7 +260,7 @@ def steps(self) -> List[dict]: return [p for p in self.parts if p.get("script")] or [{"id": "run", "label": "the run", "script": self.script}] def check(self) -> Optional[str]: - if not _NAME.match(self.name): + if not _NAME.fullmatch(self.name): return "the run needs a name: letters, digits, dots, dashes" if not self.script.strip() and not any(p.get("script") for p in self.parts): return "nothing to run" diff --git a/app/tests/test_execution.py b/app/tests/test_execution.py index 1827de05..11486e32 100644 --- a/app/tests/test_execution.py +++ b/app/tests/test_execution.py @@ -19,6 +19,17 @@ from tests.execution_support import Base, HostBase, LocalHost, gone +class PlanValidation(unittest.TestCase): + def test_run_names_must_match_in_full(self): + for name in ("nightly", "run_1.2-3", "a" * 80): + with self.subTest(name=name): + self.assertIsNone(execution.Plan(name=name, script="true").check()) + for name in ("nightly\n", "nightly\r\n", "night ly", "", "a" * 81): + with self.subTest(name=name): + self.assertEqual(execution.Plan(name=name, script="true").check(), + "the run needs a name: letters, digits, dots, dashes") + + class Here(Base): """Local runs are real: bash, setsid, the exit file, the log."""