benglerpebbles/hailstorm — Issue #3: Patchbay load test as the start point
Author: tomkoptel
Created: 2012-01-11 14:06:03+00:00
State: open

DSL configuration

```ruby
Process.start do

UID.config do
pattern "tracker:[realm].[place].[id]"
realms ["mittap", "lorem", "ipsum", "segundum"]
places ["moon", "jupiter", "saturn", "pluto"]
end

config = Configuration.instance
config.load "load_test_config.yml"

Level.config config.levels

routes = Route.new config.host do
get { "/trackers/#{UID.all.join(",")}" }
delete { "/trackers/#{UID.next}" }
post "/trackers"
end

Scenario.config do
routes routes
post_params post_params
end

end
```

load_test_config.yml

```yaml
host: "http://localhost:9292/api/patchbay/v1"
levels:
- :duration: 10
:sleep: 2
:threads_count: 3
- :duration: 60
:sleep: 2
:threads_count: 5
- :duration: 60
:sleep: 2
:threads_count: 10
- :duration: 60
:sleep: 2
:threads_count: 25
- :duration: 60
:sleep: 0.5
:threads_count: 25
scenarios:
- :http_get
- :http_post
- :http_delete
```

UID config - responsible for generating UID`s which used in generating dynamic routes.
Configuration - load everything from .yml
Level config - instantiate all level instances mentioned in .yml file.
Route config - allows to instantiate as well as static and dynamic routes specific for API.
Scenario config - interface responsible for execution HTTP methods while period (duration in level).

Level structure:
- duration - time during which HTTP requests will be executed
- threads_count - number of threads for LoadTest process.
- sleep - delay for simulating real life conditions.

The main idea of this example is to be start point for both implementation of `Hailstorm` and `Kcuts`.
This code can play the role of DSL, which returns configurations on the basis of Pebbled which uses `Hailstorm` and `Kcuts`.