From 1d871258c45a76e2c76bb1bf98393168d9f91ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joonas=20Saraj=C3=A4rvi?= Date: Thu, 13 Oct 2022 12:29:09 +0300 Subject: [PATCH] Allow requesting repeated runs of tests --- etp-backend/src/main/clj/user.clj | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/etp-backend/src/main/clj/user.clj b/etp-backend/src/main/clj/user.clj index 178f3edd5..e9986f148 100644 --- a/etp-backend/src/main/clj/user.clj +++ b/etp-backend/src/main/clj/user.clj @@ -30,11 +30,15 @@ (let [cpu-count (.availableProcessors (Runtime/getRuntime)) thread-count (if-let [thread-limit (System/getenv "ETP_THREAD_LIMIT")] (min (Integer/parseInt thread-limit) cpu-count) - cpu-count)] + cpu-count) + repeat-count (if-let [cnt (System/getenv "ETP_TEST_REPEATS")] + (Integer/parseInt cnt) + 1)] (require 'eftest.runner) - (->> ((resolve 'eftest.runner/find-tests) "src/test") - (filter (matching-test test-searches)) - ((resolve 'eftest.runner/run-tests))))) + (as-> ((resolve 'eftest.runner/find-tests) "src/test") $ + (filter (matching-test test-searches) $) + (reduce concat [] (repeat repeat-count $)) + ((resolve 'eftest.runner/run-tests) $ {:thread-count thread-count})))) (defn run-tests-and-exit! [] (let [{:keys [fail error]} (run-tests (map re-pattern *command-line-args*))]