Skip to content

Commit

Permalink
Revert back to the original, less-flaky version of this test.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias committed Apr 17, 2015
1 parent 433e1ed commit 2824344
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions web/test-integration/immutant/web/integ_test.clj
Expand Up @@ -186,23 +186,22 @@
:on-open (fn [ch]
(let [query-string (:query-string (async/originating-request ch))]
(async/send! ch (last (re-find #"x=(.*)$" query-string))))))))
(let [messages (atom [])
(let [results (atom [])
clients (atom [])
results (promise)
done? (promise)
client-count 40]
(dotimes [n client-count]
(future
(let [client (ws/connect (str (cdef-url "ws") "?x=" n)
:on-receive (fn [m]
(swap! messages conj m)
(when (= client-count (count @messages))
(deliver results @messages))))]
(swap! results conj m)
(when (= client-count (count @results))
(deliver done? true))))]
(swap! clients conj client))))
(let [results' (deref results 10000 nil)]
(is results')
(println "RESULTS" results')
(is (= (->> client-count (range 0) (map str) set)
(set results'))))
(is (deref done? 5000 nil))
(println "RESULTS" @results)
(is (= (->> client-count (range 0) (map str) set)
(set @results)))
(doseq [client @clients]
(.close client))))

Expand Down

0 comments on commit 2824344

Please sign in to comment.