slightly dirty tric to pass the test

This commit is contained in:
Valentin Boettcher 2020-08-14 18:53:21 +02:00
parent 6173ba060e
commit ea240dffc1
2 changed files with 12 additions and 11 deletions

View file

@ -137,6 +137,12 @@
; Monitoring ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn- put-process-event!
[id data]
(a/put! master-monitor {:type :process-event
:id id
:event data}))
(defn- handle-process-error!
[event id]
(when-let [proc (get-process! id)]
@ -146,6 +152,9 @@
:start-failed (diagnose-start-error (:message (:details event)) proc)
nil)]
(put-process-event! id {:type :new-problem
:problem problem})
(dosync
(alter processes
(fn [procs]
@ -153,12 +162,6 @@
updated-proc (assoc proc :problems (conj (:problems proc) problem))]
(assoc procs id updated-proc))))))))
(defn- put-process-event!
[id data]
(a/put! master-monitor {:type :process-event
:id id
:event data}))
(defn- handle-status-event!
"Handles status `event`s from the process with the `id`."
[id event]

View file

@ -42,10 +42,6 @@
(testing "starting a process (which will fail)"
(is (not (:success @(p/start! proc)))))
(testing "problem diagnosis"
(is ((:problems (api/get-process! (:id proc)))
:ffmpeg-not-found)))
(testing "spilling junk into the monitor channel"
(a/>!! (:monitor proc) "junk"))
@ -61,7 +57,9 @@
(let [c (a/chan)]
(a/sub api/monitor :process-event c)
(p/start! proc)
(is (= (:id proc) (:id (a/<!! c))))))
(is (= (:id proc) (:id (a/<!! c))))
(is ((:problems (api/get-process! (:id proc)))
:ffmpeg-not-found))))
(testing "deleting the process"
(is (api/delete-process! proc))