From 288addedaa45673223dbefa2c9e8839d232e1195 Mon Sep 17 00:00:00 2001 From: Harenome Ranaivoarivony-Razanajato Date: Mon, 16 Nov 2026 15:29:49 +0100 Subject: [PATCH 1/5] test(execution): wait 60 s for a run's end in the execution tests The shared wait() gave a run 10 s to end. On a loaded machine a run that works can take longer. join() returns when the run ends, so a passing test takes the same time as before. --- app/tests/execution_support.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/tests/execution_support.py b/app/tests/execution_support.py index b477a1d8..2d33acba 100644 --- a/app/tests/execution_support.py +++ b/app/tests/execution_support.py @@ -25,8 +25,8 @@ def setUp(self): self.addCleanup(execution.EXECUTIONS.clear) docker = mock.patch.object(execution, "docker_here", return_value=None); docker.start(); self.addCleanup(docker.stop) - def wait(self, ex, seconds=10): - ex.thread.join(seconds); self.assertFalse(ex.thread.is_alive(), "the run did not end") + def wait(self, ex, seconds=60): + ex.thread.join(seconds); self.assertFalse(ex.thread.is_alive(), "the run did not end") # join returns when the run ends; 60 s is for a loaded machine return ex def until(self, ex, state, seconds=10): From 854dd46052caef59c520cb5d68708b4f647bd31c Mon Sep 17 00:00:00 2001 From: Harenome Ranaivoarivony-Razanajato Date: Mon, 16 Nov 2026 15:29:49 +0100 Subject: [PATCH 2/5] test(standard): give the workspace kit's driver 60 s to reply The kit isolation tests gave each setup and score request 10 s. On a loaded machine the driver can take longer. request() returns at the reply, so a passing test takes the same time as before. --- app/tests/test_kit_check_isolation.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/tests/test_kit_check_isolation.py b/app/tests/test_kit_check_isolation.py index 5de23955..6acceab1 100644 --- a/app/tests/test_kit_check_isolation.py +++ b/app/tests/test_kit_check_isolation.py @@ -49,9 +49,9 @@ def plant_calc(self): def test_on_docker_the_fix_check_runs_in_a_container_of_the_units_image(self): d = self.driver(**{container.CHECK_IMAGE: "nullius/base:test", "PATH": self.bin + os.pathsep + os.environ["PATH"]}) - d.request("setup", unit="fix", dir=self.ws, timeout=10) + d.request("setup", unit="fix", dir=self.ws, timeout=60) marker = self.plant_calc() - reply = d.request("score", unit="fix", dir=self.ws, transcript="", answer="", timeout=10) + reply = d.request("score", unit="fix", dir=self.ws, transcript="", answer="", timeout=60) self.assertFalse(os.path.exists(marker)) # the agent's calc.py was never imported here self.assertTrue(reply["passed"]) argv = json.loads(Path(self.argv_log).read_text()) @@ -62,9 +62,9 @@ def test_on_docker_the_fix_check_runs_in_a_container_of_the_units_image(self): def test_locally_the_fix_check_runs_here_as_the_agent_did(self): d = self.driver() - d.request("setup", unit="fix", dir=self.ws, timeout=10) + d.request("setup", unit="fix", dir=self.ws, timeout=60) marker = self.plant_calc() - self.assertTrue(d.request("score", unit="fix", dir=self.ws, transcript="", answer="", timeout=10)["passed"]) + self.assertTrue(d.request("score", unit="fix", dir=self.ws, transcript="", answer="", timeout=60)["passed"]) self.assertTrue(os.path.exists(marker)) self.assertFalse(os.path.exists(self.argv_log)) @@ -73,11 +73,11 @@ def test_a_planted_link_is_not_followed(self): with open(secret, "w") as f: f.write("nullius-ok") # would even pass, read through the link os.symlink(secret, os.path.join(self.ws, "result.txt")) - reply = self.driver().request("score", unit="write", dir=self.ws, transcript="", answer="", timeout=10) + reply = self.driver().request("score", unit="write", dir=self.ws, transcript="", answer="", timeout=60) self.assertEqual((reply["passed"], reply["detail"]["result.txt"]), (False, None)) bashrc = Path(self.tmp, "bashrc"); bashrc.write_text("mine\n") os.symlink(bashrc, os.path.join(self.ws, "test_calc.py")) # the test is rewritten in place, never through a link - self.driver().request("score", unit="fix", dir=self.ws, transcript="", answer="", timeout=10) + self.driver().request("score", unit="fix", dir=self.ws, transcript="", answer="", timeout=60) self.assertEqual(bashrc.read_text(), "mine\n") From b4fddf0963de1ae1901f70d1848a1ada9d105f8e Mon Sep 17 00:00:00 2001 From: Harenome Ranaivoarivony-Razanajato Date: Mon, 16 Nov 2026 15:50:58 +0100 Subject: [PATCH 3/5] test(standard): wait 60 s for each run of the installed snapshot test The test gave each of its three runs 15 s to end, and the whole driver 120 s. On a loaded machine a run that works can take longer. Each run now has 60 s and the driver 240 s, room for the three runs. join() and run() return at the end, so a passing test takes the same time as before. --- app/tests/test_standard_payload.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/tests/test_standard_payload.py b/app/tests/test_standard_payload.py index 38e9ada2..1e58e631 100644 --- a/app/tests/test_standard_payload.py +++ b/app/tests/test_standard_payload.py @@ -350,7 +350,7 @@ def inventory(): before = inventory() for index in range(3): execution_ = execution.Execution(make_plan(index)).start() - execution_.thread.join(15) + execution_.thread.join(60) assert not execution_.thread.is_alive(), "fixture did not finish" assert execution_.state == "done", execution_.lines assert execution_.app_on_target == str(snapshot), "a later launch must reuse the same snapshot" @@ -363,7 +363,7 @@ def inventory(): "snapshot": execution_.app_on_target, "successful_launches": 3})) ''' ran = subprocess.run([str(python), "-I", "-B", "-c", driver], cwd=cwd, env=env, - capture_output=True, text=True, timeout=120) + capture_output=True, text=True, timeout=240) self.assertEqual(ran.returncode, 0, ran.stdout + ran.stderr) parent = json.loads(ran.stdout) self.assertEqual(parent["providers"], [str(installed)]) From e768bd0d8b3584dab4a70fc330148735ee782dfc Mon Sep 17 00:00:00 2001 From: Harenome Ranaivoarivony-Razanajato Date: Mon, 16 Nov 2026 16:10:29 +0100 Subject: [PATCH 4/5] test(standard): give each kit driver 60 s to list its units The check details test gave each kit driver 10 s to reply to units. On a loaded machine a driver that works can take longer. request() returns at the reply, so a passing test takes the same time as before. --- app/tests/test_standard_definitions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/tests/test_standard_definitions.py b/app/tests/test_standard_definitions.py index ea0c6cb6..8e56a449 100644 --- a/app/tests/test_standard_definitions.py +++ b/app/tests/test_standard_definitions.py @@ -201,7 +201,7 @@ def test_catalogue_check_details_cover_the_driver_units(self): cwd=tmp, env=dict(os.environ, PYTHONPATH=str(APP)), log=os.path.join(tmp, "driver.log")) try: - units = driver.request("units", dataset="kit", timeout=10)["units"] + units = driver.request("units", dataset="kit", timeout=60)["units"] finally: driver.close() details = kit["check_details"] From 1403a6cdd75f3258f542dc49b667421a31509e28 Mon Sep 17 00:00:00 2001 From: Harenome Ranaivoarivony-Razanajato Date: Mon, 16 Nov 2026 16:50:38 +0100 Subject: [PATCH 5/5] test(standard): wait until a killed unit's background child is gone The scope test gave the child of a killed group 0.2 s to go. On a loaded machine it can take longer. The test now polls with gone(), as the other process tests do, for up to 30 s. The limit stays under the child's own 60 s sleep, so a child that the run leaves running still fails the test. gone() returns when the child is gone, so a passing test takes no longer than before. --- app/tests/test_constraints.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/tests/test_constraints.py b/app/tests/test_constraints.py index b5dd39d4..f719ac41 100644 --- a/app/tests/test_constraints.py +++ b/app/tests/test_constraints.py @@ -13,12 +13,12 @@ import sys import tempfile import threading -import time import unittest from unittest import mock from nullius import constraints, prerequisites, settings from nullius.standard import container, definitions, install, recipe, run +from tests.execution_support import gone ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "fixtures", "standard", "catalogue") ALL = {"cpus": 2, "memory_mb": 512, "processes": 100, "concurrency": 3, "cpu_set": "0-1", "gpu_ids": [0]} @@ -502,9 +502,7 @@ def test_a_unit_past_its_timeout_is_killed_with_its_group(self): run.run_group(cmd, 1, env=env) with open(f"{d}/child") as f: child = int(f.read()) - time.sleep(0.2) - with self.assertRaises(ProcessLookupError): # the background child went with its group - os.kill(child, 0) + self.assertTrue(gone(child, 30), "the background child outlived its group") # under its own 60 s: a child left running fails def probe(self, values=None, ssh=False, systemctl=0, linger="yes", runs="exit 0", bus=True, booted=True, v2=True, tools=True): """``scope_check`` against stand-ins for systemd's programs and files."""