Skip to content

Commit 2586344

Browse files
plexusbbatsov
authored andcommitted
Increase timeout in debug-integration-test, fail loudly upon timeout
These tests use special `--->` and `<---` macros to sketch out an interaction with the debugger, but the `<---` macro (nrepl-recv) did not account for the possibility of a timeout. A timeout would result in receiving a `nil` message, which was then treated as an empty map as far as assertions are concerned. When this happened the actual and expected messages would get out of sync, causing all future assertions in the same test var to also fail. This commit increases the timeout from 200 to 500 ms, and throws an exception when a timeout does occur.
1 parent 30ba8f3 commit 2586344

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/clj/cider/nrepl/middleware/debug_integration_test.clj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
(transport/send *transport* msg)))
4343

4444
(defn nrepl-recv []
45-
(let [msg (transport/recv *transport* 200)]
45+
(let [msg (transport/recv *transport* 500)]
4646
(dbg "<==" msg)
4747
msg))
4848

@@ -113,6 +113,10 @@
113113
assertions (for [[k v] expected]
114114
`(is (= ~v (get ~msg-sym ~k)) (str "Message: " ~msg-sym)))]
115115
`(let [~msg-sym (nrepl-recv)]
116+
(when (nil? ~msg-sym)
117+
(throw (ex-info (str "Unexpected timeout waiting for nREPL response. "
118+
"Expected message: " (prn-str ~expected))
119+
{})))
116120
~@assertions
117121
(when-let [k# (:key ~msg-sym)]
118122
(.put *debugger-key* k#))

0 commit comments

Comments
 (0)