Skip to content

Commit

Permalink
Gather some more data on this integ failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias committed May 13, 2015
1 parent cd2e6e4 commit 98865e2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion web/test-integration/immutant/web/integ_test.clj
Expand Up @@ -179,6 +179,13 @@
(is (= (str "/" path)
(-> result (deref 5000 "nil") read-string :path-info)))))))

(let [serializer (java.util.concurrent.Executors/newSingleThreadExecutor)]
(defn mark [& msg]
(let [^Runnable r #(apply println
(.format (java.text.SimpleDateFormat. "HH:mm:ss,SSS")
(java.util.Date.)) msg)]
(.submit serializer r))))

(deftest concurrent-ws-requests-should-not-cross-streams
(replace-handler
'(fn [request]
Expand All @@ -192,14 +199,16 @@
client-count 40]
(dotimes [n client-count]
(future
(mark "CLIENT SEND" n)
(let [client (ws/connect (str (cdef-url "ws") "?x=" n)
:on-receive (fn [m]
(mark "CLIENT RCVD" m)
(swap! results conj m)
(when (= client-count (count @results))
(deliver done? true))))]
(swap! clients conj client))))
(is (deref done? 10000 nil))
(println "RESULTS" @results)
(mark "RESULTS" @results)
(is (= (->> client-count (range 0) (map str) set)
(set @results)))
(doseq [client @clients]
Expand Down

0 comments on commit 98865e2

Please sign in to comment.