   (:require [clj-gatling.simulation :as simulation]
             [clj-gatling.httpkit :as httpkit]
             [clj-gatling.simulation-util :refer [choose-runner
-                                                 weighted-scenarios]]
+                                                 weighted-scenarios
+                                                 create-dir]]
             [clj-containment-matchers.clojure-test :refer :all]
             [clj-async-test.core :refer :all]
             [clojure.core.async :refer [go <! <!! timeout]]

                                     :result false}]}]))))

(deftest when-function-throws-exception-it-is-logged
  (let [result (-> {:name "Exception logging scenario"
                    :steps [{:name "Throwing" :request (fn [_] (throw (Exception. "Simulated")))}]}
                   ;; FIXME: output will probably be jumbled with concurrency > 1
                   (run-single-scenario :concurrency 1))]
    ))

(deftest simulation-passes-context-through-requests-in-scenario
  (let [result (run-single-scenario {:name "scenario"

      results)))

(def error-file-path "target/test-results/error.log")

(defn- setup-error-file-path
  [f]
  (let [file (clojure.java.io/file error-file-path)]
    (when (not (.exists file))
      (create-dir (.getParent file))))
  (f))

;; Just setup the file path once
(use-fixtures :once setup-error-file-path)

(defn- run-legacy-simulation [scenarios concurrency & [options]]
  (let [step-timeout (or (:timeout-in-ms options) 5000)]
