Skip to content

Commit

Permalink
Make channel timeout tests more robust on slow hardware.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias committed Aug 5, 2015
1 parent 4585a38 commit 437b622
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion web/test-integration/immutant/web/integ_test.clj
Expand Up @@ -614,6 +614,7 @@
(with-open [socket (ws/connect (cdef-url "ws")
:on-receive #(deliver ready %))]
(is (= "open" (deref ready 1000 :failure)))
(Thread/sleep 100)
(is (= :closed (read-string (get-body (str (cdef-url) "state"))))))))

(deftest ws-timeout-should-occur-when-truly-idle
Expand Down Expand Up @@ -641,6 +642,7 @@
(swap! data conj m))))]
(is (= "done" (deref ready 1000 :failure)))
(is (= ["0" "1" "2" "3"] @data))
(Thread/sleep 100)
(is (= :closed (read-string (get-body (str (cdef-url) "state"))))))))

(deftest stream-should-timeout-when-idle
Expand Down Expand Up @@ -674,7 +676,9 @@
:on-close (fn [_ reason]
(deliver @client-state :closed)))))]
(replace-handler handler)
(is (= [0 1 2 3] (read-string (get-body (cdef-url)))))
(let [:keys [body status] (get-response (cdef-url))]
(is (= 200 status))
(is (= [0 1 2 3] (read-string body))))
(is (= :closed (read-string (get-body (str (cdef-url) "state")))))))

;; TODO: build a long-running random test
Expand Down

0 comments on commit 437b622

Please sign in to comment.