test helper function misc changes
This commit is contained in:
parent
472a551606
commit
f8dfde4e3a
|
@ -57,6 +57,13 @@
|
|||
[]
|
||||
(Thread/sleep 500))
|
||||
|
||||
(defn wait-for-heartbeat-interval
|
||||
(defn wait-for-scheduled-interval
|
||||
[secs]
|
||||
; add 1 extra second just to be 100% safe
|
||||
; (intervals specified to scheduled job/task timers are never _exact_)
|
||||
(Thread/sleep (+ 1000 (* 1000 secs))))
|
||||
|
||||
(defn session-id-string?
|
||||
[s]
|
||||
(and (string? s)
|
||||
(not (string/blank? s))))
|
||||
|
|
|
@ -52,8 +52,7 @@
|
|||
(let [arrays (get-response-arrays (:body resp))
|
||||
[[id [c session-id host-prefix version]]] (first arrays)]
|
||||
(is (= "c" c))
|
||||
(is (and (string? session-id)
|
||||
(not (string/blank? session-id))))
|
||||
(is (session-id-string? session-id))
|
||||
(is (nil? host-prefix))
|
||||
(is (= protocol-version version))
|
||||
(is (get @sessions session-id))
|
||||
|
@ -107,8 +106,7 @@
|
|||
(let [arrays (get-response-arrays (:body new-session-response))
|
||||
[[_ [c session-id _ _]]] (first arrays)]
|
||||
(is (= "c" c))
|
||||
(is (and (string? session-id)
|
||||
(not (string/blank? session-id))))
|
||||
(is (session-id-string? session-id))
|
||||
session-id))
|
||||
|
||||
(deftest backchannel-request-test
|
||||
|
@ -195,7 +193,7 @@
|
|||
create-resp (app (->new-session-request) options)
|
||||
session-id (get-session-id create-resp)
|
||||
back-resp (app (->new-backchannel-request session-id))]
|
||||
(wait-for-heartbeat-interval (:keep-alive-interval options))
|
||||
(wait-for-scheduled-interval (:keep-alive-interval options))
|
||||
(let [async-resp @async-output
|
||||
arrays (get-response-arrays (:body async-resp))]
|
||||
(is (= 200 (:status back-resp)))
|
||||
|
|
|
@ -81,9 +81,7 @@
|
|||
; browserchannel's buffering proxy test is supposed to work by initially sending
|
||||
; "11111", then waits for 2 seconds (without closing the response), then sends
|
||||
; "2" and finally closes the response.
|
||||
; wait for 3 secs just to be safe
|
||||
(println "*** WAITING 3 SECONDS FOR BUFFERING PROXY TEST RESPONSE TO FINISH ***")
|
||||
(Thread/sleep 3000)
|
||||
(wait-for-scheduled-interval 2)
|
||||
(let [async-resp @async-output]
|
||||
(is (:closed? async-resp))
|
||||
(is (= "111112" (:body async-resp))))))
|
||||
|
|
Reference in a new issue