ruby-jmeter 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby-version +1 -0
- data/examples/{basic_grid.rb → basic_flood.rb} +5 -1
- data/lib/ruby-jmeter/dsl.rb +29 -9
- data/lib/ruby-jmeter/version.rb +1 -1
- metadata +5 -7
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p448
|
@@ -5,4 +5,8 @@ test do
|
|
5
5
|
threads count: 1 do
|
6
6
|
visit name: 'Home Page', url: 'http://google.com/'
|
7
7
|
end
|
8
|
-
end.
|
8
|
+
end.flood('qCL6dv7qzqeBB7LYSR2x', {
|
9
|
+
name: 'Demo using flood.io',
|
10
|
+
region: 'us-west-2',
|
11
|
+
endpoint: 'dev.api.flood.io:3000'
|
12
|
+
})
|
data/lib/ruby-jmeter/dsl.rb
CHANGED
@@ -346,12 +346,12 @@ module RubyJmeter
|
|
346
346
|
logger.info "Local Results at: #{params[:jtl] ? params[:jtl] : 'jmeter.jtl'}"
|
347
347
|
end
|
348
348
|
|
349
|
-
def
|
349
|
+
def flood(token, params={})
|
350
350
|
if params[:region] == 'local'
|
351
351
|
logger.info "Starting test ..."
|
352
352
|
params[:started] = Time.now
|
353
353
|
run params
|
354
|
-
params[:
|
354
|
+
params[:stopped] = Time.now
|
355
355
|
logger.info "Completed test ..."
|
356
356
|
logger.debug "Uploading results ..." if params[:debug]
|
357
357
|
end
|
@@ -360,21 +360,41 @@ module RubyJmeter
|
|
360
360
|
file = Tempfile.new(['jmeter', '.jmx'])
|
361
361
|
file.write(doc.to_xml(:indent => 2))
|
362
362
|
file.rewind
|
363
|
-
|
363
|
+
|
364
|
+
response = RestClient.post "#{params[:endpoint] ? params[:endpoint] : 'https://flood.io'}/floods?auth_token=#{token}",
|
364
365
|
{
|
365
|
-
:
|
366
|
+
:flood => {
|
367
|
+
:tool => 'jmeter',
|
368
|
+
:url => params[:url],
|
369
|
+
:plan => File.new("#{file.path}", 'rb'),
|
370
|
+
:plan_cache => '',
|
371
|
+
:name => params[:name],
|
372
|
+
:notes => params[:notes],
|
373
|
+
:tag_list => params[:tag_list],
|
374
|
+
:threads => params[:threads],
|
375
|
+
:rampup => params[:ramup],
|
376
|
+
:duration => params[:duration],
|
377
|
+
# specials for API
|
378
|
+
:started => params[:started],
|
379
|
+
:stopped => params[:stopped]
|
380
|
+
},
|
366
381
|
:results => (File.new("#{params[:jtl] ? params[:jtl] : 'jmeter.jtl'}", 'rb') if params[:region] == 'local'),
|
382
|
+
:region => params[:region],
|
367
383
|
:multipart => true,
|
368
|
-
:content_type => 'application/octet-stream'
|
369
|
-
:started => params[:started],
|
370
|
-
:completed => params[:completed]
|
384
|
+
:content_type => 'application/octet-stream'
|
371
385
|
}.merge(params)
|
372
|
-
|
386
|
+
if response.code == 200
|
387
|
+
logger.info "Flood results at: #{JSON.parse(response)["response"]["link"]}"
|
388
|
+
else
|
389
|
+
logger.fatal "Sorry there was an error: #{JSON.parse(response)["error_description"]}"
|
390
|
+
end
|
373
391
|
rescue => e
|
374
|
-
logger.fatal "Sorry there was
|
392
|
+
logger.fatal "Sorry there was a fatal error: #{e.message}"
|
375
393
|
end
|
376
394
|
end
|
377
395
|
|
396
|
+
alias_method :grid, :flood
|
397
|
+
|
378
398
|
private
|
379
399
|
|
380
400
|
def hash_tree
|
data/lib/ruby-jmeter/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-jmeter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- .gitattributes
|
55
55
|
- .gitignore
|
56
56
|
- .rspec
|
57
|
+
- .ruby-version
|
57
58
|
- Gemfile
|
58
59
|
- LICENSE.txt
|
59
60
|
- README.md
|
@@ -64,10 +65,10 @@ files:
|
|
64
65
|
- examples/basic_cache.rb
|
65
66
|
- examples/basic_cookies.rb
|
66
67
|
- examples/basic_extract.rb
|
68
|
+
- examples/basic_flood.rb
|
67
69
|
- examples/basic_gc_dummy_sampler.rb
|
68
70
|
- examples/basic_gc_results.rb
|
69
71
|
- examples/basic_google.rb
|
70
|
-
- examples/basic_grid.rb
|
71
72
|
- examples/basic_header.rb
|
72
73
|
- examples/basic_ldap_ext.rb
|
73
74
|
- examples/basic_post.rb
|
@@ -243,7 +244,4 @@ rubygems_version: 1.8.23
|
|
243
244
|
signing_key:
|
244
245
|
specification_version: 3
|
245
246
|
summary: This is a Ruby based DSL for writing JMeter test plans
|
246
|
-
test_files:
|
247
|
-
- spec/dsl_spec.rb
|
248
|
-
- spec/spec_helper.rb
|
249
|
-
- spec/stub.rb
|
247
|
+
test_files: []
|