<commit_before>(ns org.zalando.stups.friboo.system.cron-test
  (:require [org.zalando.stups.friboo.system.cron :refer :all]
            [clojure.test :refer :all]
            [overtone.at-at :as at]
            [com.stuartsierra.component :as component]))

(def-cron-component TestCron [state]
  (at/at (at/now) (job deliver state 42) pool))

(deftest test-cron-component-lifecycle
  ;; Here we make sure that the component is started and stopped properly.
  (let [state (promise)
        cron-component (map->TestCron {:state state})]
    (-> cron-component
        component/start
        component/stop
        component/stop) ; stopping twice shouldn't break anything
    (is (= 42 (deref state 500 :not-delivered)))))<commit_msg>Fix race condition in unit test<commit_after>(ns org.zalando.stups.friboo.system.cron-test
  (:require [org.zalando.stups.friboo.system.cron :refer :all]
            [clojure.test :refer :all]
            [overtone.at-at :as at]
            [com.stuartsierra.component :as component]))

(def-cron-component TestCron [state]
  (at/at (at/now) (job deliver state 42) pool))

(deftest test-cron-component-lifecycle
  ;; Here we make sure that the component is started and stopped properly.
  (let [state (promise)
        cron-component (component/start (map->TestCron {:state state}))]
    (is (= 42 (deref state 500 :not-delivered)))
    (-> cron-component
        component/stop
        component/stop))) ; stopping twice shouldn't break anything
{'fraction_non_alphanumeric': 0.12702702702702703, 'fraction_numerical': 0.00945945945945946, 'mean_word_length': 3.091160220994475, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1364855', 'n_tokens_mistral': 508, 'n_tokens_neox': 479, 'n_words': 126}