Skip to content

Commit

Permalink
Add thread info.
Browse files Browse the repository at this point in the history
Add some information about the thread each test ran on. May want to move
this to something not specific to parallelization, otherwise
non-parallel tests won't have any thread info.
  • Loading branch information
alysbrooks authored and plexus committed May 12, 2023
1 parent c449f58 commit 47664ec
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/kaocha/testable.clj
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@
(recur (conj result r) testables)))
result))))

(defn current-thread-info []
(let [thread (Thread/currentThread)]
{:name (.getName thread)
:id (.getId thread)
:group-name (.getName (.getThreadGroup thread))}))

(defn run-testables-parallel
"Run a collection of testables, returning a result collection."
[testables test-plan]
Expand All @@ -280,7 +286,7 @@
(contains? types (:kaocha.testable/type %)) (dissoc :parallel)
(and (hierarchy/suite? %) (contains? suites (:kaocha.testable/desc %))) (dissoc :parallel)
true (update :levels (fn [x] (if (nil? x) 1 (inc x)))))]
(run-testable % test-plan))))
(run-testable (assoc % ::thread (current-thread-info) ) test-plan))))
testables)]
(comment (loop [result [] ;(ArrayBlockingQueue. 1024)
[test & testables] testables]
Expand Down

0 comments on commit 47664ec

Please sign in to comment.