Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass timeout CLI param to clj-gatling runner #6

Merged
merged 1 commit into from Aug 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Expand Up @@ -48,7 +48,7 @@ Note! Clojider 0.4.0 supports latest [clj-gatling](https://github.com/mhjort/clj
lein run install -r <lambda-region> -b <s3-bucket-name> -f target/<your-uberjar-path>
```

### 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.
Expand All @@ -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

Expand All @@ -85,6 +85,10 @@ See [clj-gatling](https://github.com/mhjort/clj-gatling) on how to define test s
lein run update -r <lambda-region> -b <s3-bucket-name> -f target/<your-uberjar-path>
```

### 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).
Expand All @@ -96,6 +100,8 @@ However, I still wanted to have an option to destroy everything when you don't n
lein run uninstall -r <lambda-region> -b <s3-bucket-name>
```



## Contribute

Use [GitHub issues](https://github.com/mhjort/clojider/issues) and [Pull Requests](https://github.com/mhjort/clojider/pulls).
9 changes: 7 additions & 2 deletions src/clojider/core.clj
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/clojider/rc.clj
Expand Up @@ -75,6 +75,7 @@
:node-id node-id
:users users
:duration %
:timeout-in-ms (:timeout-in-ms options)
:simulation-namespaces [(symbol-namespace simulation)]))
durations)))))

Expand Down