ruby-jmeter 2.11.1 → 2.11.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -412,7 +412,14 @@ module RubyJmeter
412
412
  logger.warn "Test executing locally ..."
413
413
  properties = params.has_key?(:properties) ? params[:properties] : "#{File.dirname(__FILE__)}/helpers/jmeter.properties"
414
414
  properties = "-q #{properties}" if properties
415
- cmd = "#{params[:path]}jmeter #{"-n" unless params[:gui] } -t #{params[:file]} -j #{params[:log] ? params[:log] : 'jmeter.log' } -l #{params[:jtl] ? params[:jtl] : 'jmeter.jtl' } #{properties}"
415
+
416
+ if params[:remote_hosts]
417
+ remote_hosts = params[:remote_hosts]
418
+ remote_hosts = remote_hosts.join(',') if remote_hosts.kind_of?(Array)
419
+ remote_hosts = "-R #{remote_hosts}"
420
+ end
421
+
422
+ cmd = "#{params[:path]}jmeter #{"-n" unless params[:gui] } -t #{params[:file]} -j #{params[:log] ? params[:log] : 'jmeter.log' } -l #{params[:jtl] ? params[:jtl] : 'jmeter.jtl' } #{properties} #{remote_hosts}"
416
423
  logger.debug cmd if params[:debug]
417
424
  Open3.popen2e("#{cmd}") do |stdin, stdout_err, wait_thr|
418
425
  while line = stdout_err.gets
@@ -1,3 +1,3 @@
1
1
  module RubyJmeter
2
- VERSION = "2.11.1"
2
+ VERSION = "2.11.2"
3
3
  end
data/spec/dsl_spec.rb CHANGED
@@ -726,7 +726,7 @@ describe "DSL" do
726
726
 
727
727
  it 'pass a properties file' do
728
728
  Open3.should_receive(:popen2e)
729
- .with('jmeter -n -t jmeter.jmx -j jmeter.log -l jmeter.jtl -q my-jmeter.properties')
729
+ .with('jmeter -n -t jmeter.jmx -j jmeter.log -l jmeter.jtl -q my-jmeter.properties ')
730
730
 
731
731
  test do
732
732
  end.run(properties: 'my-jmeter.properties')
@@ -734,7 +734,7 @@ describe "DSL" do
734
734
 
735
735
  it 'do not pass a properties file' do
736
736
  Open3.should_receive(:popen2e)
737
- .with("jmeter -n -t jmeter.jmx -j jmeter.log -l jmeter.jtl -q #{deflate_properties}")
737
+ .with("jmeter -n -t jmeter.jmx -j jmeter.log -l jmeter.jtl -q #{deflate_properties} ")
738
738
 
739
739
  test do
740
740
  end.run
@@ -742,11 +742,28 @@ describe "DSL" do
742
742
 
743
743
  it 'pass a nil properties file' do
744
744
  Open3.should_receive(:popen2e)
745
- .with('jmeter -n -t jmeter.jmx -j jmeter.log -l jmeter.jtl ')
745
+ .with('jmeter -n -t jmeter.jmx -j jmeter.log -l jmeter.jtl ')
746
746
 
747
747
  test do
748
748
  end.run(properties: nil)
749
749
  end
750
+
751
+ it 'pass remote hosts' do
752
+ Open3.should_receive(:popen2e)
753
+ .with("jmeter -n -t jmeter.jmx -j jmeter.log -l jmeter.jtl -R 192.168.1.1,192.168.1.2")
754
+
755
+ test do
756
+ end.run(properties: nil, remote_hosts: '192.168.1.1,192.168.1.2')
757
+ end
758
+
759
+ it 'pass remote hosts (Array)' do
760
+ Open3.should_receive(:popen2e)
761
+ .with('jmeter -n -t jmeter.jmx -j jmeter.log -l jmeter.jtl -R 192.168.1.1,192.168.1.2')
762
+
763
+ test do
764
+ end.run(properties: nil, remote_hosts: ['192.168.1.1', '192.168.1.2'])
765
+ end
766
+
750
767
  end
751
768
 
752
769
  end
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.11.1
4
+ version: 2.11.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: 2014-01-19 00:00:00.000000000 Z
12
+ date: 2014-01-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client