Fork me on GitHub
#kaocha
<
2019-10-07
>
daniel.spaniel12:10:38

Is there a way to set config variables when running koacha? For example our application runs with a mount/start state :config variable that sets up some variables for the application to use. Since tests don't mount/start I am trying to send in to koacha ( before it runs ) some config variables or even try to set that mount state config variable like this:

daniel.spaniel12:10:41

(ns setup-test
  (:require [mount.core :as mount]))

(def test-config
  {:conn               :mem-conn
   :certificate-secret "cert-secret"
   :secret             "secret"
   :encrypt-secret     "encrypt-secret"})

(defn test-setup [_]
  (mount/start-with
    {#'dataico.server-components.config/config (fn [_] test-config)}))

(clojure.test/use-fixtures :once test-setup)

daniel.spaniel12:10:19

but this is pretty stupid because though it works .. it is a "test" file .. and since we running randomized tests it might run who knows when

daniel.spaniel12:10:00

so is there a way to run this file first thing before any tests or is there another way to set that config mount state ? up front ?

plexus12:10:17

I think hooks are what you are looking for

plexus12:10:00

There's a brief description of the available hooks in the plugin writing docs https://cljdoc.org/d/lambdaisland/kaocha/0.0-549/doc/9-extending#extension-types

daniel.spaniel13:10:06

your right @plexus... that is what i am looking for. thanks for letting me know 🙂