From 13662273313c3fa8d344b6b1095a56b51eccf87a Mon Sep 17 00:00:00 2001 From: Markus Hjort Date: Mon, 29 Aug 2016 08:56:42 +0300 Subject: [PATCH] Pass timeout CLI param to clj-gatling runner --- README.md | 10 ++++++++-- src/clojider/core.clj | 9 +++++++-- src/clojider/rc.clj | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fbecb12..9a729f6 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Note! Clojider 0.4.0 supports latest [clj-gatling](https://github.com/mhjort/clj lein run install -r -b -f target/ ``` -### Writing tests +## Writing tests You can find few simple examples [here](https://github.com/mhjort/clojider/blob/master/src/clojider/examples.clj) which you run locally in a following way. @@ -64,7 +64,7 @@ or See [clj-gatling](https://github.com/mhjort/clj-gatling) on how to define test scenarios. -### Running tests +## Running tests ### Locally @@ -85,6 +85,10 @@ See [clj-gatling](https://github.com/mhjort/clj-gatling) on how to define test s lein run update -r -b -f target/ ``` +### Optional parameters + + * `-t` or `--timeout`` specifies request timeout in milliseconds. By default it is 5000 ms. + ## Uninstall This will uninstall all created AWS resources (S3 bucket, role, policy and Lambda function). @@ -96,6 +100,8 @@ However, I still wanted to have an option to destroy everything when you don't n lein run uninstall -r -b ``` + + ## Contribute Use [GitHub issues](https://github.com/mhjort/clojider/issues) and [Pull Requests](https://github.com/mhjort/clojider/pulls). diff --git a/src/clojider/core.clj b/src/clojider/core.clj index d69fd7f..16234d5 100644 --- a/src/clojider/core.clj +++ b/src/clojider/core.clj @@ -18,22 +18,27 @@ ["-n" "--nodes NODES" "How many Lambda nodes to use" :default 1 :parse-fn #(Integer/parseInt %)] + ["-t" "--timeout TIMEOUT" "Rquest timeout in milliseconds" + :default 5000 + :parse-fn #(Integer/parseInt %)] ["-d" "--duration DURATION" "Duration in seconds" :default (t/seconds 1) :parse-fn #(t/seconds (Integer/parseInt %))]]) -(defn run-with-lambda [{:keys [simulation region bucket concurrency nodes duration]}] +(defn run-with-lambda [{:keys [simulation region bucket concurrency nodes duration timeout]}] (rc/run-simulation (symbol simulation) {:region region :concurrency concurrency :node-count nodes :bucket-name bucket + :timeout-in-ms timeout :duration duration})) -(defn run-using-local-machine [{:keys [simulation concurrency duration]}] +(defn run-using-local-machine [{:keys [simulation concurrency duration timeout]}] (load (symbol-namespace simulation)) (gatling/run (eval (read-string simulation)) {:concurrency concurrency :root "tmp" + :timeout-in-ms timeout :duration duration})) (def cmds diff --git a/src/clojider/rc.clj b/src/clojider/rc.clj index fafe0c0..75978b0 100644 --- a/src/clojider/rc.clj +++ b/src/clojider/rc.clj @@ -75,6 +75,7 @@ :node-id node-id :users users :duration % + :timeout-in-ms (:timeout-in-ms options) :simulation-namespaces [(symbol-namespace simulation)])) durations)))))