CI: tolerate runner mtime lag and stream heartbeat race in 2 browser tests (test-only, no production code change; playwright: 0.05s sleep after write_control, runner mtime lags wall clock 0.2-1.0ms; stream: drain waiting heartbeats until EOF after terminal status)
ci / test (push) Failing after 16m9s
ci / test (push) Failing after 16m9s
This commit is contained in:
1 parent
a2c539999e
commit
c1cb3f3d82
2 files changed
+19
-1
No files matched your search
@@ -171,6 +171,12 @@ class BridgeTestCase(unittest.TestCase):
|
||||
self.assertEqual(effective_holder(self.tmp.name, state),
|
||||
"agent")
|
||||
write_control(self.tmp.name, "user")
|
||||
# Gitea runner filesystem mtime lags wall clock by ~1ms
|
||||
# (measured 0.2-1.0ms in runner container), so a
|
||||
# back-to-back write can appear older than updated_at.
|
||||
# Wait out the lag; the test's intent is "newer control
|
||||
# wins", not "same-millisecond writes are ordered".
|
||||
time.sleep(0.05)
|
||||
self.assertEqual(effective_holder(self.tmp.name, state),
|
||||
"user")
|
||||
# Once the MCP polls, the state file catches up and both
|
||||
|
||||
@@ -214,7 +214,19 @@ class BrowserProxyTestCase(unittest.TestCase):
|
||||
db.commit()
|
||||
finally:
|
||||
db.close()
|
||||
line = resp.readline().decode("utf-8")
|
||||
# Terminal status ends the stream, but a waiting
|
||||
# heartbeat may fire first on a loaded runner; drain
|
||||
# waiting frames until EOF instead of requiring the
|
||||
# first line after the update to be EOF.
|
||||
for _ in range(20):
|
||||
line = resp.readline().decode("utf-8")
|
||||
if line == "":
|
||||
break
|
||||
if line.strip() == "":
|
||||
continue
|
||||
payload = json.loads(line[6:]) if line.startswith("data: ") else {}
|
||||
if not payload.get("waiting"):
|
||||
break
|
||||
self.assertEqual(line, "")
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
Reference in new issue
Block a user