mirror of
https://github.com/openglow-org/forgefirm.git
synced 2026-09-28 01:01:12 -07:00
forgetest: the cloud tests wait out the service's thinking
wait_quiet took the machine as quiet after 8 s without the start of a motion, a park, a run or a lens homing. Between a lid image and its next move the service is working on the image and the log is silent, and on the bench reference the re-hunt's moves came 9.6 s apart: cloud.mode-switch switched back to GRBL mode in the middle of the re-hunt, twice, the first time canceling a motion at 988 of its 1002 steps. Every line of a service action now counts as activity: the requests, the image uploads, the action ends, the runs, the parks, the motions and the lens homing. The quiet is 30 s. Over 1901 motion, lid-image and hunt requests in the bench reference's logs, half came within 1.6 s of the line before, 99 percent within 12.8 s, and two after more than 30 s (32.8 and 62.2 s). return_head goes: cloud.mode-switch hands its cloud stretch back through the cloud client's log (homeoff.cloud_mode_return), and nothing else called it. RETURN_MAX_MM moves to homeoff, its one user. Proof: tests/test_cloud_suite.py's new case lands a motion, a lid image 0.8 s later and the next move 1.6 s after the motion, with the quiet at 1 s: the quiet comes after the move. With the old activity marks it is declared after the image, before the move. forgetest 499 OK. Acceptance: cloud.mode-switch gates the change on a machine, its re-hunt waited out before the switch back. The fingerprints of every test in suite/cloud.py and of every module that imports from it move: 29 tests, the cloud tests, events.button-telemetry, the exthost tests, homing.cloud-offsets and setup.check-envelope.
This commit is contained in:
@@ -563,6 +563,29 @@ class CloudSuiteTests(unittest.TestCase):
|
||||
cloud.QUIET_TIMEOUT_S = 3 # this one waits the deadline out; tearDown puts it back
|
||||
self.assertFails(cloud.enter_cloud, "still running service moves")
|
||||
|
||||
def test_the_quiet_waits_out_the_service_thinking_after_a_lid_image(self):
|
||||
# Between a lid image and the service's next move the log is silent
|
||||
# while the service works on the image (the re-hunt on the bench
|
||||
# reference, 2026-09-25). The quiet counts from the image's own
|
||||
# lines, so it is not declared in that gap: it comes after the move.
|
||||
cloud.QUIET_S = 1.0
|
||||
offset = cloud.log_size(self.log)
|
||||
p = "2026-09-25T16:43:%s+00:00 gfcloud[12821] INFO "
|
||||
self.append([p % "20.103479" + "gfuiservice:run service action request: motion (ready)",
|
||||
p % "20.105376" + "machine:_motion start motion",
|
||||
p % "22.617720" + "machine:_motion_locked end positions (12120, 7402, 0)",
|
||||
p % "22.618542" + "machine:_motion end motion",
|
||||
p % "22.619218" + "basemachine:_finish_action motion [1588864337]: finished with event "
|
||||
"\":completed\""])
|
||||
self.append([p % "23.249589" + "gfuiservice:run service action request: lid_image (ready)",
|
||||
p % "24.686536" + "websocket:img_upload COMPLETE"], delay=0.8)
|
||||
self.append([p % "29.667978" + "gfuiservice:run service action request: motion (ready)",
|
||||
p % "29.671663" + "machine:_motion start motion"], delay=1.6)
|
||||
run = Run("test", "cloud.x", "cloud.x")
|
||||
ctx = Context(run, None, helpers.make_test("cloud.x", []))
|
||||
self.assertTrue(cloud.wait_quiet(ctx, offset))
|
||||
self.assertIn("service action request: motion", cloud.log_lines_since(self.log, offset)[-2])
|
||||
|
||||
# -- the hunt with the lid open ------------------------------------------
|
||||
# -- the mode switch: hunt with the lid open, then $H -----------------------
|
||||
HUNT_RUN_SAMPLE = {"phase": "run", "verdict": "ok", "armed": False,
|
||||
|
||||
Reference in New Issue
Block a user