From 12d73d0f637afa3d7fa791869da3728ea9fe797a Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 12 Nov 2026 06:27:40 +0000 Subject: [PATCH] :bug: Fix flaky assertion in climit waiting-count test The test expected exactly one publication of the :rpc-climit-waiting gauge inside the with-redefs window. The republisher daemon thread, started at component init with no delay and rescheduling every 15 s, publishes the same counter and can land inside that window, so the recorded sequence could be [0 0] and the assertion failed with actual [0 +0] (Backend Tests job in #12979). Assert on the last published value instead of the whole sequence, the contract waiting-last documents and the sibling tests use. AI-assisted-by: inkling-2-small-free --- backend/test/backend_tests/climit_test.clj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/test/backend_tests/climit_test.clj b/backend/test/backend_tests/climit_test.clj index 76aff9252a..d65b2a500a 100644 --- a/backend/test/backend_tests/climit_test.clj +++ b/backend/test/backend_tests/climit_test.clj @@ -445,9 +445,11 @@ (t/is (thrown? clojure.lang.ExceptionInfo (invoke! cfg (fn [_ _] :never) {})))) - ;; the count came back down instead of staying up for good + ;; the count came back down instead of staying up for good. The + ;; republisher daemon thread can add publications inside the window, + ;; so what is asserted is the last value, not the whole sequence. (t/is (= 0 (waiting-count climit name))) - (t/is (= [0] (waiting-value-of name))) + (t/is (= 0 (waiting-last name))) ;; and the thread dropped the mark: with it left behind, this call would ;; run inline instead of waiting for the permit another thread holds.