Fix flaky wait for test

This commit is contained in:
Michiel Borkent 2019-12-18 09:38:45 +01:00
parent 96b04b50ef
commit d88c28ff50

View file

@ -7,7 +7,8 @@
[clojure.string :as str] [clojure.string :as str]
[clojure.test :as test :refer [deftest is testing]] [clojure.test :as test :refer [deftest is testing]]
[clojure.java.io :as io] [clojure.java.io :as io]
[sci.core :as sci])) [sci.core :as sci]
[clojure.test :as t]))
(defn bb [input & args] (defn bb [input & args]
(edn/read-string (apply test-utils/bb (when (some? input) (str input)) (map str args)))) (edn/read-string (apply test-utils/bb (when (some? input) (str input)) (map str args))))
@ -189,6 +190,7 @@
(bb nil "(def ws (-> (ProcessBuilder. [\"python\" \"-m\" \"SimpleHTTPServer\" \"1777\"]) (.start))) (bb nil "(def ws (-> (ProcessBuilder. [\"python\" \"-m\" \"SimpleHTTPServer\" \"1777\"]) (.start)))
(wait/wait-for-port \"127.0.0.1\" 1777) (wait/wait-for-port \"127.0.0.1\" 1777)
(.destroy ws) (.destroy ws)
(.waitFor ws)
(wait/wait-for-port \"localhost\" 1777 {:default :timed-out :timeout 50})")))) (wait/wait-for-port \"localhost\" 1777 {:default :timed-out :timeout 50})"))))
(deftest wait-for-path-test (deftest wait-for-path-test
@ -291,6 +293,10 @@
(deftest future-print-test (deftest future-print-test
(testing "the root binding of sci/*out*" (testing "the root binding of sci/*out*"
(is (= "hello" (bb nil "@(future (prn \"hello\"))")))) (is (= "hello" (bb nil "@(future (prn \"hello\"))")))))
;;;; Scratch
(comment
(dotimes [i 10] (wait-for-port-test))
) )