weavejester / reagi

An FRP library for Clojure and ClojureScript
232 stars 13 forks source link

Race condition in test of "once" #13

Open fredZen opened 8 years ago

fredZen commented 8 years ago

This test fails occasionally: (core_test.clj lines 464-468)

(testing "once"
  (let [j (r/join (r/once 1) (r/once 2) (r/once 3))]
    (is (realized? j))
    (is (r/complete? j))
    (is (= (deref! j) 3)))))

The test fails because there is a race condition in the assertion (is (realized? j)): if the go block underlying r/join hasn't started pumping data into j yet, then j will still be unrealized and the test will fail.

weavejester commented 8 years ago

Thanks for the report. This test likely needs some delay or blocking check before the realized?.