-
-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
I think the value returned from the :fallback on with-retry is not used. I can reproduce this by modifying the fallback test.
(deftest fallback
;; This is the original test
(testing "fallback value is same as original value"
(is (= 10 (dh/with-retry {:fallback (fn [v e]
(is (= v 10))
(is (nil? e))
v)
:retry-if (fn [v e] (< v 10))}
dh/*executions*)))
;; Here I changed fallback to instead return :fail.
(testing "fallback value is different from original value"
(is (= :fail (dh/with-retry {:fallback (fn [v e]
(is (= v 10))
(is (nil? e))
:fail)
:retry-if (fn [v e] (< v 10))}
dh/*executions*))))))
1 non-passing tests:
Fail in fallback
fallback value is same as original value fallback value is different from original value
expected: :fail
actual: 10
diff: - :fail
+ 10
Here's a simpler test that also fails:
(deftest simple-fallback
(is (= :fallback (dh/with-retry {:retry-when false
:max-retries 3
:fallback :fallback}
false))))
1 non-passing tests:
Fail in simple-fallback
expected: :fallback
actual: false
diff: - :fallback
+ false
I'm not sure :fallback is even running though:
(dh/with-retry {:retry-when false
:max-retries 3
:on-success (fn [_ _] (println "success"))
:on-failure (fn [_ _] (println "failure"))
:on-retry (fn [_ _] (println "retry"))
:fallback (fn [_ _] (println "fallback") :fallback)}
false)
;; retry
;; retry
;; retry
;; failure
;; => false
devurandom
Metadata
Metadata
Assignees
Labels
No labels