forked from mhjort/trombi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.clj
79 lines (68 loc) · 2.27 KB
/
schema.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
(ns clj-gatling.schema
(:require [schema.core :as s]))
(def Step
{:name s/Str
(s/optional-key :sleep-before) (s/make-fn-schema s/Int [[{}]])
:request (s/make-fn-schema s/Any [[{:user-id s/Int}]])})
(def RunnableScenario
{:name s/Str
:users [s/Int]
(s/optional-key :context) (s/pred map?)
(s/optional-key :skip-next-after-failure?) Boolean
(s/optional-key :allow-early-termination?) Boolean
(s/optional-key :pre-hook) s/Any
(s/optional-key :post-hook) s/Any
(s/optional-key :steps) [Step]
(s/optional-key :step-fn) (s/pred ifn?)})
(def Scenario
{:name s/Str
(s/optional-key :context) (s/pred map?)
(s/optional-key :weight) s/Int
(s/optional-key :skip-next-after-failure?) Boolean
(s/optional-key :allow-early-termination?) Boolean
(s/optional-key :pre-hook) s/Any
(s/optional-key :post-hook) s/Any
(s/optional-key :steps) [Step]
(s/optional-key :step-fn) (s/pred ifn?)})
(def Simulation
{:name s/Str
(s/optional-key :pre-hook) s/Any
(s/optional-key :post-hook) s/Any
:scenarios [Scenario]})
(def CollectorInput
{:context {}
:results-dir s/Str})
(def Collector
(s/make-fn-schema {:collect s/Any
:combine s/Any}
[[CollectorInput]]))
(def GeneratorInput
{:context {}
:results-dir s/Str})
(def Generator
(s/make-fn-schema {:generate s/Any
:as-str s/Any}
[[GeneratorInput]]))
(def Reporter
{:reporter-key s/Keyword
:collector (s/either s/Symbol Collector)
:generator (s/either s/Symbol s/Any)})
(def Executor
(s/make-fn-schema {} [[s/Int Simulation {}]]))
(def Options
{(s/optional-key :concurrency) s/Int
(s/optional-key :root) s/Str
(s/optional-key :executor) Executor
(s/optional-key :nodes) s/Int
(s/optional-key :timeout-in-ms) s/Int
(s/optional-key :context) (s/pred map?)
(s/optional-key :requests) s/Int
(s/optional-key :duration) org.joda.time.ReadablePeriod
(s/optional-key :concurrency-distribution) (s/make-fn-schema
float
[[float {}]])
(s/optional-key :error-file) s/Str
(s/optional-key :reporter) s/Any ;Legacy fn
(s/optional-key :reporters) [Reporter]
(s/optional-key :parallelism) s/Int
})