Answer stability round 1: 1 🔴, 5 🟡 (0 misread); the 🔴, the rule text and the PATH half of the exemption were answered in the principles round 1 commit; exempt no docker under sudo or doas, test unknown memory and the shim without a share, keep helped beside unlimited, drop a dead fallback

This commit is contained in:
2026-10-24 11:37:08 +02:00
parent e551a2b5a9
commit c87e9f19d6
5 changed files with 23 additions and 12 deletions
+1 -1
View File
@@ -32,4 +32,4 @@ def main(argv: list[str], env: typing.Mapping[str, str]) -> int:
def without_path_entry(path: str) -> str:
"""path less PATH_ENTRY, so the real docker is the one found."""
return os.pathsep.join(entry for entry in path.split(os.pathsep) if pathlib.Path(entry or ".").resolve() != PATH_ENTRY)
return os.pathsep.join(entry for entry in path.split(os.pathsep) if pathlib.Path(entry).resolve() != PATH_ENTRY)
+10
View File
@@ -115,6 +115,16 @@ class RunHeavy(unittest.TestCase):
result = self.run_tool("sh", "-c", "command -v docker || echo none", env={**self.env, "PATH": folder.name})
self.assertEqual((result.returncode, result.stdout), (0, "none\n"))
def test_the_capped_docker_passes_a_call_on_unchanged_without_a_share(self):
env = self.fake_docker()
env.pop("RUN_HEAVY_MEMORY", None)
shim = pathlib.Path(TOOL).parent / "run_heavy" / "path_entry" / "docker"
result = subprocess.run([str(shim), "run", "img"], capture_output=True, text=True, env=env, timeout=30)
self.assertEqual((result.returncode, result.stdout), (0, "run img\n"))
def test_no_cap_where_the_memory_is_unknown(self):
self.assertEqual(main.capping(None, 4, self.fake_docker()), {})
def test_a_capped_docker_that_finds_no_docker_exits_127_saying_so(self):
folder = tempfile.TemporaryDirectory()
self.addCleanup(folder.cleanup)