mirror of
https://github.com/penpot/penpot.git
synced 2026-09-21 11:55:08 -04:00
🐛 Fix flaky heartbeat throttle test on same-millisecond writes
Submit and heartbeat can land in the same millisecond, which made the strict modified-at > created-at assertion fail intermittently. Backdate modified-at before the first heartbeat so the write is always observable, keeping the strict comparison. AI-assisted-by: muse-spark-1.3-contributor
This commit is contained in:
1 parent
0739148a20
commit
381eec07e2
1 file changed
+4
@@ -256,6 +256,10 @@
|
||||
::jobs/params (make-params)})]
|
||||
|
||||
(t/testing "first heartbeat writes"
|
||||
;; Backdate modified-at: submit and heartbeat can land in the same
|
||||
;; millisecond, which would make a strict > assertion flaky.
|
||||
(th/db-update! :job {:modified-at (ct/in-past {:seconds 5})}
|
||||
{:id job-id})
|
||||
(jobs/heartbeat! cfg job-id)
|
||||
(let [row (jobs/get-job cfg job-id)]
|
||||
(t/is (> (inst-ms (:modified-at row)) (inst-ms (:created-at row))))))
|
||||
|
||||
Reference in new issue
Block a user