lib/stella/adapter/httperf.rb in stella-0.5.3 vs lib/stella/adapter/httperf.rb in stella-0.5.4
- old
+ new
@@ -19,26 +19,31 @@
class Httperf < Stella::Adapter::Base
attr_accessor :hog, :server, :uri, :num_conns, :num_calls, :rate, :timeout, :think_timeout, :port
- attr_accessor :add_header, :burst_length, :client, :close_with_reset, :debug, :failure_status
+ attr_accessor :burst_length, :client, :close_with_reset, :debug, :failure_status
attr_accessor :help, :http_version, :max_connections, :max_piped_calls, :method, :no_host_hdr
attr_accessor :period, :print_reply, :print_request, :recv_buffer, :retry_on_failure, :send_buffer
- attr_accessor :server_name, :session_cookies, :ssl, :ssl_ciphers, :ssl_no_reuse, :verbose
- attr_accessor :version, :wlog, :wsess, :wsesslog, :wset
+ attr_accessor :server_name, :session_cookies, :ssl, :ssl_ciphers, :ssl_no_reuse, :verbose
+ attr_writer :version, :add_header, :wlog, :wsess, :wsesslog, :wset
+
def initialize(options={}, arguments=[])
super(options, arguments)
@name = 'httperf'
@private_variables = ['private_variables', 'name', 'arguments', 'load_factor', 'working_directory']
@load_factor = 1
end
-
+
+ def error
+ (File.exists? stderr_path) ? FileUtil.read_file(stderr_path) : "Unknown error"
+ end
+
# Before calling run
def before
end
@@ -139,14 +144,12 @@
end
def version
vsn = 0
- text = ""
- Open3.popen3("#{@name} --version") do |stdin, stdout, stderr|
- text = stdout.readlines.join
- text.scan(/httperf\-([\d\.]+)\s/) { |v| vsn = v[0] }
+ Stella::Util.capture_output("#{@name} --version") do |stdout, stderr|
+ stdout.join.scan(/httperf\-([\d\.]+)\s/) { |v| vsn = v[0] }
end
vsn
end
# loadtest
@@ -220,14 +223,14 @@
# Siege writes the summary to STDERR
def stats_file
- File.new(stdout_path)
+ File.new(stdout_path) if File.exists?(stdout_path)
end
def rc_file
- File.join(@working_directory, "siegerc")
+ File.join(@working_directory, "siegerc")
end
def log_file
File.join(@working_directory, "siege.log")
end
\ No newline at end of file