diff --git a/test/laundry/antivirus_test.clj b/test/laundry/antivirus_test.clj index 9c6515c..b667794 100644 --- a/test/laundry/antivirus_test.clj +++ b/test/laundry/antivirus_test.clj @@ -9,10 +9,19 @@ [ring.mock.request :as mock] [ring.util.request])) +(defn query-clamav-health! [] + (let [ret (shell/sh + "docker" "inspect" "-f" "{{.State.Running}}" "laundry-clamav")] + (-> ret + :out + string/trim-newline))) + (defn laundry-clamav-fixture! [f] (shell/sh "docker" "run" "--name" "laundry-clamav" "--env" "CLAMAV_NO_FRESHCLAMD=true" "--network=none" "--rm" "-d" "clamav/clamav:latest") - ;; clamd bootup is somewhat slow, thus need to sleep a bit before container can be used - (Thread/sleep 30000) + ;; clamd bootup is slow, thus need to wait for container healthy stat + (while (not= "healthy" (query-clamav-health!)) + (println "waiting for clamav container healthy status") + (Thread/sleep 5000)) (f) (shell/sh "docker" "stop" "laundry-clamav"))