Fix test
This commit is contained in:
parent
23ba52a813
commit
1da01203ce
1 changed files with 19 additions and 16 deletions
|
|
@ -23,19 +23,22 @@
|
||||||
(try ~@body (finally (s# :timeout 100)))))
|
(try ~@body (finally (s# :timeout 100)))))
|
||||||
|
|
||||||
(deftest websockets-smoke-test
|
(deftest websockets-smoke-test
|
||||||
(with-ws-server {:on-receive #(httpkit.server/send! %1 %2)}
|
(when-not (and
|
||||||
(is (= "zomg websockets!"
|
(= "aarch64" (System/getenv "BABASHKA_ARCH"))
|
||||||
(let [p (promise)
|
(= "true" (System/getenv "BABASHKA_STATIC")))
|
||||||
ws (ws-client/build-websocket "ws://localhost:1234"
|
(with-ws-server {:on-receive #(httpkit.server/send! %1 %2)}
|
||||||
{:on-binary (fn [_ data last?] (deliver p data))
|
(is (= "zomg websockets!"
|
||||||
:on-text (fn [ws data last?] (deliver p data))
|
(let [p (promise)
|
||||||
:on-error (fn [ws throwable] (deliver p throwable))
|
ws (ws-client/build-websocket "ws://localhost:1234"
|
||||||
:on-ping (fn [ws data] (deliver p data))
|
{:on-binary (fn [_ data last?] (deliver p data))
|
||||||
:on-pong (fn [ws data] (deliver p data))
|
:on-text (fn [ws data last?] (deliver p data))
|
||||||
:on-open (fn [ws] nil)
|
:on-error (fn [ws throwable] (deliver p throwable))
|
||||||
:on-close (fn [ws status-code reason] nil)})]
|
:on-ping (fn [ws data] (deliver p data))
|
||||||
(-> ws
|
:on-pong (fn [ws data] (deliver p data))
|
||||||
(ws-client/send "zomg websockets!"))
|
:on-open (fn [ws] nil)
|
||||||
(try (deref p 5000 ::timeout)
|
:on-close (fn [ws status-code reason] nil)})]
|
||||||
(finally
|
(-> ws
|
||||||
(ws-client/close ws))))))))
|
(ws-client/send "zomg websockets!"))
|
||||||
|
(try (deref p 5000 ::timeout)
|
||||||
|
(finally
|
||||||
|
(ws-client/close ws)))))))))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue