module BigBench::Configuration

The configuration is configured in the test reciepts and looks like this:

BigBench.configure = {
  :duration    => 10.seconds,
  :output      => "test.ljson",
  :users       => 20,
  :basic_auth  => ['username', 'secret']
}

Single values can be set and retrieved like this:

BigBench.config.duration = 20.minutes
BigBench.config.duration # => 1200 (seconds)

The following configuration values are possible - stared configurations need to be present:

duration*

How long will the benchmark take by default. This value can be overridden by every benchmark.

output*

The file where the results should be written to. Usually one takes the *.ljson format which is simply a file that contains a fully valid JSON object on every line. This makes it easy to process the results later on, because there’s no need to parse the whole results JSON, which can get huge, at once.

users

How many users execute the benchmarks concurrently. This can be overridden by every benchmark and defaults to 1.

basic_auth

A basic authentication that is used by ALL requests. This can be overridden per fragment in every benchmark.

BigBench.config.basic_auth = ['username', 'password']

Public Class Methods

config() click to toggle source

Returns the current config object

# File lib/bigbench/configuration.rb, line 76
def self.config
  @config
end
configure=(config) click to toggle source

Configures the benchmarks with a hash. If the config methods are not present yet, they are added to the config object

# File lib/bigbench/configuration.rb, line 67
def self.configure=(config)
  raise "Config must be a Hash" unless config.is_a?(Hash)
  config.each { |option, value|
    @config.class.add_option(option)
    @config.send "#{option}=", value
  }
end
reset!() click to toggle source

Resets the config object

# File lib/bigbench/configuration.rb, line 81
def self.reset!
  @config = Config.new
end