stella 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +14 -10
- data/Rakefile +22 -36
- data/lib/daemonize.rb +56 -0
- data/lib/stella/adapter/ab.rb +49 -39
- data/lib/stella/adapter/base.rb +17 -8
- data/lib/stella/adapter/httperf.rb +24 -18
- data/lib/stella/adapter/pcap_watcher.rb +1 -1
- data/lib/stella/adapter/siege.rb +15 -12
- data/lib/stella/cli/localtest.rb +2 -3
- data/lib/stella/cli/sysinfo.rb +0 -1
- data/lib/stella/cli.rb +10 -55
- data/lib/stella/command/base.rb +0 -62
- data/lib/stella/command/localtest.rb +35 -36
- data/lib/stella/data/domain.rb +18 -11
- data/lib/stella/data/http.rb +23 -16
- data/lib/stella/logger.rb +29 -19
- data/lib/stella/response.rb +5 -2
- data/lib/stella/storable.rb +138 -52
- data/lib/stella/support.rb +107 -8
- data/lib/stella/sysinfo.rb +26 -16
- data/lib/stella/test/definition.rb +1 -1
- data/lib/stella/test/run/summary.rb +23 -13
- data/lib/stella/test/stats.rb +114 -0
- data/lib/stella/text/resource.rb +1 -1
- data/lib/stella.rb +29 -4
- data/lib/utils/mathutil.rb +0 -76
- data/lib/utils/stats.rb +88 -0
- data/lib/win32/Console/ANSI.rb +305 -305
- data/lib/win32/Console.rb +970 -970
- data/support/ruby-pcap-takuma-patch.txt +13 -13
- data/support/text/en.yaml +11 -8
- data/support/text/nl.yaml +7 -1
- data/{spec/show-agents_spec.rb → tests/01-util_test.rb} +0 -0
- data/tests/02-stella-util_test.rb +42 -0
- data/tests/10-stella_test.rb +104 -0
- data/tests/11-stella-storable_test.rb +68 -0
- data/tests/60-stella-command_test.rb +248 -0
- data/tests/80-stella-cli_test.rb +45 -0
- data/tests/spec-helper.rb +31 -0
- data/vendor/{frylock/README.textile → drydock/LICENSE.txt} +2 -52
- data/vendor/drydock/README.textile +57 -0
- data/vendor/{frylock → drydock}/bin/example +14 -14
- data/vendor/{frylock/frylock.gemspec → drydock/drydock.gemspec} +1 -1
- data/vendor/{frylock/lib/frylock → drydock/lib/drydock}/exceptions.rb +1 -1
- data/vendor/{frylock/lib/frylock.rb → drydock/lib/drydock.rb} +8 -8
- data/vendor/{frylock → drydock}/test/command_test.rb +0 -0
- metadata +34 -61
- data/lib/stella/test/base.rb +0 -38
- data/lib/stella/test/summary.rb +0 -82
- data/vendor/hitimes-0.4.0/HISTORY +0 -28
- data/vendor/hitimes-0.4.0/LICENSE.txt +0 -19
- data/vendor/hitimes-0.4.0/README +0 -80
- data/vendor/hitimes-0.4.0/Rakefile +0 -63
- data/vendor/hitimes-0.4.0/examples/benchmarks.rb +0 -86
- data/vendor/hitimes-0.4.0/examples/stats.rb +0 -29
- data/vendor/hitimes-0.4.0/ext/extconf.rb +0 -15
- data/vendor/hitimes-0.4.0/ext/hitimes_ext.c +0 -21
- data/vendor/hitimes-0.4.0/ext/hitimes_instant_clock_gettime.c +0 -20
- data/vendor/hitimes-0.4.0/ext/hitimes_instant_osx.c +0 -16
- data/vendor/hitimes-0.4.0/ext/hitimes_instant_windows.c +0 -27
- data/vendor/hitimes-0.4.0/ext/hitimes_interval.c +0 -340
- data/vendor/hitimes-0.4.0/ext/hitimes_interval.h +0 -73
- data/vendor/hitimes-0.4.0/ext/hitimes_stats.c +0 -242
- data/vendor/hitimes-0.4.0/ext/hitimes_stats.h +0 -30
- data/vendor/hitimes-0.4.0/ext/rbconfig-mingw.rb +0 -178
- data/vendor/hitimes-0.4.0/ext/rbconfig.rb +0 -178
- data/vendor/hitimes-0.4.0/gemspec.rb +0 -54
- data/vendor/hitimes-0.4.0/lib/hitimes/mutexed_stats.rb +0 -23
- data/vendor/hitimes-0.4.0/lib/hitimes/paths.rb +0 -54
- data/vendor/hitimes-0.4.0/lib/hitimes/stats.rb +0 -29
- data/vendor/hitimes-0.4.0/lib/hitimes/timer.rb +0 -223
- data/vendor/hitimes-0.4.0/lib/hitimes/version.rb +0 -42
- data/vendor/hitimes-0.4.0/lib/hitimes.rb +0 -24
- data/vendor/hitimes-0.4.0/spec/interval_spec.rb +0 -115
- data/vendor/hitimes-0.4.0/spec/mutex_stats_spec.rb +0 -34
- data/vendor/hitimes-0.4.0/spec/paths_spec.rb +0 -14
- data/vendor/hitimes-0.4.0/spec/spec_helper.rb +0 -6
- data/vendor/hitimes-0.4.0/spec/stats_spec.rb +0 -72
- data/vendor/hitimes-0.4.0/spec/timer_spec.rb +0 -105
- data/vendor/hitimes-0.4.0/spec/version_spec.rb +0 -27
- data/vendor/hitimes-0.4.0/tasks/announce.rake +0 -39
- data/vendor/hitimes-0.4.0/tasks/config.rb +0 -107
- data/vendor/hitimes-0.4.0/tasks/distribution.rake +0 -53
- data/vendor/hitimes-0.4.0/tasks/documentation.rake +0 -33
- data/vendor/hitimes-0.4.0/tasks/extension.rake +0 -64
- data/vendor/hitimes-0.4.0/tasks/rspec.rake +0 -31
- data/vendor/hitimes-0.4.0/tasks/rubyforge.rake +0 -52
- data/vendor/hitimes-0.4.0/tasks/utils.rb +0 -80
data/lib/stella/adapter/siege.rb
CHANGED
@@ -38,7 +38,7 @@ module Stella
|
|
38
38
|
attr_accessor :rc, :file, :time, :benchmark, :internet
|
39
39
|
|
40
40
|
def initialize(options={}, arguments=[])
|
41
|
-
|
41
|
+
|
42
42
|
@name = 'siege'
|
43
43
|
@reps = 1
|
44
44
|
@concurrent = 1
|
@@ -47,6 +47,8 @@ module Stella
|
|
47
47
|
|
48
48
|
@rc = File.join(ENV['HOME'] || ENV['USERPROFILE'], '.siegerc')
|
49
49
|
|
50
|
+
super(options, arguments)
|
51
|
+
|
50
52
|
# Siege won't run unless there's a siegerc file. If the default one doesn't exist
|
51
53
|
# we need to call siege.config to create it. This should only happen once.
|
52
54
|
# We use capture_output here so STDOUT and STDERR don't print to the screen.
|
@@ -121,12 +123,10 @@ module Stella
|
|
121
123
|
|
122
124
|
update_orig_logfile if @orig_logfile
|
123
125
|
|
124
|
-
save_stats
|
125
126
|
end
|
126
127
|
|
127
128
|
|
128
|
-
def
|
129
|
-
options = OpenStruct.new
|
129
|
+
def process_arguments(arguments)
|
130
130
|
opts = OptionParser.new
|
131
131
|
opts.on('-V', '--version') do |v| @version = v end
|
132
132
|
opts.on('-h', '--help') do |v| @help = v end
|
@@ -147,9 +147,6 @@ module Stella
|
|
147
147
|
opts.on('-i', '--internet') do |v| @internet = true; end
|
148
148
|
opts.on('-A S', '--user-agent=S', String) do |v| @user_agent ||= []; @user_agent << v end
|
149
149
|
|
150
|
-
unless options.benchmark
|
151
|
-
Stella::LOGGER.warn('--benchmark (or -b) is not selected. Siege will include "think-time" for all requests.')
|
152
|
-
end
|
153
150
|
|
154
151
|
opts.on('-n N',Integer) do |v|
|
155
152
|
Stella::LOGGER.error("-n is not a Siege parameter. You probably want -r.")
|
@@ -160,7 +157,13 @@ module Stella
|
|
160
157
|
# It also fails when it finds unknown switches (i.e. -X)
|
161
158
|
# Which should leave only the remaining arguments (URIs in this case)
|
162
159
|
opts.parse!(arguments)
|
163
|
-
|
160
|
+
|
161
|
+
unless @benchmark
|
162
|
+
Stella::LOGGER.warn('--benchmark (or -b) is not selected. Siege will include "think time" for all requests.')
|
163
|
+
end
|
164
|
+
|
165
|
+
self.arguments = arguments
|
166
|
+
|
164
167
|
rescue OptionParser::InvalidOption => ex
|
165
168
|
# We want to replace this text so we grab just the name of the argument
|
166
169
|
badarg = ex.message.gsub('invalid option: ', '')
|
@@ -273,7 +276,7 @@ module Stella
|
|
273
276
|
end
|
274
277
|
|
275
278
|
# Siege writes the summary to STDERR
|
276
|
-
def
|
279
|
+
def summary_file
|
277
280
|
File.new(stderr_path) if File.exists?(stderr_path)
|
278
281
|
end
|
279
282
|
|
@@ -289,10 +292,10 @@ module Stella
|
|
289
292
|
File.join(@working_directory, File.basename(@file))
|
290
293
|
end
|
291
294
|
|
292
|
-
def
|
293
|
-
return unless
|
295
|
+
def summary
|
296
|
+
return unless summary_file
|
294
297
|
raw = {}
|
295
|
-
|
298
|
+
summary_file.each_line { |l|
|
296
299
|
l.chomp!
|
297
300
|
nvpair = l.split(':')
|
298
301
|
next unless nvpair && nvpair.size == 2
|
data/lib/stella/cli/localtest.rb
CHANGED
@@ -31,9 +31,8 @@ module Stella
|
|
31
31
|
def run
|
32
32
|
process_stella_options
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
@adapter.options = options
|
34
|
+
@adapter.process_arguments(@arguments)
|
35
|
+
|
37
36
|
@adapter.arguments = @arguments
|
38
37
|
|
39
38
|
@testdef.vusers = @adapter.vusers
|
data/lib/stella/cli/sysinfo.rb
CHANGED
data/lib/stella/cli.rb
CHANGED
@@ -1,52 +1,11 @@
|
|
1
1
|
|
2
2
|
# http://www.ruby-doc.org/stdlib/libdoc/observer/rdoc/index.html
|
3
3
|
|
4
|
-
require 'optparse'
|
5
|
-
require 'ostruct'
|
6
4
|
|
7
5
|
require 'stella/cli/base'
|
8
6
|
|
9
7
|
module Stella
|
10
8
|
|
11
|
-
# Stella::Config
|
12
|
-
#
|
13
|
-
# This Config class manages the content of ENV['HOME]/.stella. The functionality
|
14
|
-
# is currently disabled so stella is stateless.
|
15
|
-
# RUBY_PLATFORM = 'java' in jruby and i386-mswin32 for windows
|
16
|
-
class Config < Storable
|
17
|
-
USER_HOME = ENV['USERPROFILE'] || ENV['HOME']
|
18
|
-
STELLA_DIR = '.stella'
|
19
|
-
DEFAULT_HOME = File.join(USER_HOME, STELLA_DIR).freeze unless defined? DEFAULT_HOME
|
20
|
-
DEFAULT_DATA_HOME = File.join(Dir.getwd, 'stella').freeze unless defined? DEFAULT_DATA_HOME
|
21
|
-
|
22
|
-
attr_accessor :conf_path, :data_path
|
23
|
-
attr_accessor :agents
|
24
|
-
|
25
|
-
def initialize(args={:conf_path => DEFAULT_HOME})
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def working_directory
|
30
|
-
'stella'
|
31
|
-
end
|
32
|
-
|
33
|
-
# Copy the default useragents file to the config directory.
|
34
|
-
#unless File.exists? uafile_path
|
35
|
-
# default_uafile = File.join(STELLA_HOME, 'support', 'useragents.txt')
|
36
|
-
# STDERR.puts "There's no useragents.txt file. Supplied agents will be ignored" unless File.exists?(default_uafile)
|
37
|
-
# File.copy(default_uafile, @config.uafile_path, true)
|
38
|
-
#end
|
39
|
-
|
40
|
-
#def load
|
41
|
-
# puts self.methods
|
42
|
-
# loaded_config = Config.undump('yaml', FileUtil.read_file_to_array(@config_filepath))
|
43
|
-
# current_config = @config.marshal_dump
|
44
|
-
# current_config.merge! loaded_config if loaded_config.is_a? Hash
|
45
|
-
#
|
46
|
-
# @config = OpenStruct.new(current_config)
|
47
|
-
#end
|
48
|
-
|
49
|
-
end
|
50
9
|
|
51
10
|
# Stella::CLI
|
52
11
|
#
|
@@ -59,23 +18,28 @@ module Stella
|
|
59
18
|
# Auto populated with 'command' => Stella::CLI::[class] by each cli class on 'require'.
|
60
19
|
@@commands = {}
|
61
20
|
|
21
|
+
attr_reader :command_name
|
62
22
|
attr_reader :options
|
63
23
|
attr_reader :logger
|
64
|
-
|
24
|
+
attr_reader :stella_arguments
|
25
|
+
attr_reader :command_arguments
|
65
26
|
|
66
27
|
|
67
28
|
def initialize(arguments=[], stdin=nil)
|
68
29
|
@arguments = arguments
|
69
30
|
@stdin = stdin
|
70
31
|
|
71
|
-
@config = Stella::Config.new
|
72
32
|
@options = OpenStruct.new
|
73
33
|
@options.verbose = 0
|
74
|
-
@options.data_path =
|
34
|
+
@options.data_path = 'stella'
|
75
35
|
@options.agents = []
|
76
36
|
|
77
37
|
@stella_arguments = []
|
78
38
|
@command_arguments = []
|
39
|
+
|
40
|
+
process_arguments
|
41
|
+
process_options
|
42
|
+
|
79
43
|
end
|
80
44
|
|
81
45
|
def commands
|
@@ -84,9 +48,6 @@ module Stella
|
|
84
48
|
|
85
49
|
def run
|
86
50
|
|
87
|
-
process_arguments
|
88
|
-
process_options
|
89
|
-
|
90
51
|
unless (@command_name)
|
91
52
|
process_options(:display)
|
92
53
|
exit 0
|
@@ -96,7 +57,7 @@ module Stella
|
|
96
57
|
# and tell it what shortname that was used to call it.
|
97
58
|
command = @@commands[@command_name].new(@command_name)
|
98
59
|
|
99
|
-
# Give the command object access to the
|
60
|
+
# Give the command object access to the runtime options and arguments
|
100
61
|
command.stella_options = @options
|
101
62
|
command.arguments = @command_arguments
|
102
63
|
command.working_directory = @options.data_path
|
@@ -210,9 +171,7 @@ module Stella
|
|
210
171
|
agent_ary = Stella::Util::expand_str(v || 'random')
|
211
172
|
@options.agents.push(agent_ary)
|
212
173
|
end
|
213
|
-
|
214
|
-
# The following options are considered "repeatable" so they're stored in
|
215
|
-
# the config file and used as defaults for the next run.
|
174
|
+
|
216
175
|
opts.on('-d', '--datapath=S', String, Stella::TEXT.msg(:option_help_datapath, ".#{File::SEPARATOR}stella")) do |v|
|
217
176
|
@options.data_path = v.to_s
|
218
177
|
end
|
@@ -271,10 +230,6 @@ module Stella
|
|
271
230
|
|
272
231
|
Stella::LOGGER.debug("Commands (#{@command_name}): #{@@commands.keys.join(',')}")
|
273
232
|
|
274
|
-
#Stella::LOGGER.debug("Configs: ")
|
275
|
-
#@config.to_hash.each_pair do |n,v|
|
276
|
-
# Stella::LOGGER.debug(" #{n}=#{v}")
|
277
|
-
#end
|
278
233
|
|
279
234
|
Stella::LOGGER.debug("Options: ")
|
280
235
|
@options.marshal_dump.each_pair do |n,v|
|
data/lib/stella/command/base.rb
CHANGED
@@ -3,19 +3,6 @@
|
|
3
3
|
module Stella::Command
|
4
4
|
class Base
|
5
5
|
|
6
|
-
BrowserNicks = {
|
7
|
-
'ff' => 'firefox',
|
8
|
-
'ie' => 'internetexplorer'
|
9
|
-
}.freeze unless defined? BrowserNicks
|
10
|
-
|
11
|
-
OperatingSystemNicks = {
|
12
|
-
'win' => 'windows',
|
13
|
-
'lin' => 'linux',
|
14
|
-
'osx' => 'osx',
|
15
|
-
'freebsd' => 'bsd',
|
16
|
-
'netbsd' => 'bsd',
|
17
|
-
'openbsd' => 'bsd'
|
18
|
-
}.freeze unless defined? OperatingSystemNicks
|
19
6
|
|
20
7
|
# TODO: See EC2::Platform for example to improve/generalize platform
|
21
8
|
# discovery. We'll need this for monitoring.
|
@@ -47,55 +34,6 @@ module Stella::Command
|
|
47
34
|
sleep remainder if remainder > 0
|
48
35
|
end
|
49
36
|
|
50
|
-
# find_agent
|
51
|
-
#
|
52
|
-
# Takes an input string which can be either a shortname or a complete
|
53
|
-
# user agent string. If the string matches the shortname format, it
|
54
|
-
# will select an agent string from useragents.txt based on the shortname.
|
55
|
-
# Shortname takes the following format: browser-version-os.
|
56
|
-
# Examples: ff-3-linux, ie-5, opera-10-win, chrome-0.2-osx, random
|
57
|
-
# If os doesn't match, it will look for the browser and version. If it can't
|
58
|
-
# find the version it will look for the browser and apply the version given.
|
59
|
-
# If browser doesn't match a known browser, it assumes the string is a
|
60
|
-
# complete user agent and simply returns that value.
|
61
|
-
def find_agent(name,second=nil,third=nil)
|
62
|
-
name = (BrowserNicks.has_key?(name)) ? BrowserNicks[name] : name
|
63
|
-
return name unless @available_agents.has_key?(name) || name == "random"
|
64
|
-
|
65
|
-
index = name
|
66
|
-
if (second && third) # i.e. opera-9-osx
|
67
|
-
os = (OperatingSystemNicks.has_key?(third)) ? OperatingSystemNicks[third] : third
|
68
|
-
index = "#{name}-#{second}-#{os}"
|
69
|
-
elsif(second && second.to_i > 0) # i.e. opera-9
|
70
|
-
index = "#{name}-#{second}"
|
71
|
-
elsif(second) # i.e. opera-osx
|
72
|
-
os = (OperatingSystemNicks.has_key?(second)) ? OperatingSystemNicks[second] : second
|
73
|
-
index = "#{name}-#{os}"
|
74
|
-
elsif(name == "random")
|
75
|
-
index = @available_agents.keys[ rand(@available_agents.keys.size) ]
|
76
|
-
end
|
77
|
-
|
78
|
-
# Attempt to find a pool of user agents that match the supplied index
|
79
|
-
ua_pool = @available_agents[index]
|
80
|
-
|
81
|
-
# In the event we don't find an agent above (which will only happen
|
82
|
-
# when the user provided a version), we'll take a random agent for
|
83
|
-
# the same browser and apply the version supplied by the user. We
|
84
|
-
# create the index using just the major version number so if the user
|
85
|
-
# supplies a specific verswion number, they will always end up here.
|
86
|
-
unless ua_pool
|
87
|
-
os = (OperatingSystemNicks.has_key?(third)) ? OperatingSystemNicks[third] : third
|
88
|
-
index = (os) ? "#{name}-#{os}" : name
|
89
|
-
ua_tmp = @available_agents[index][ rand(@available_agents[index].size) ]
|
90
|
-
ua_tmp.version = second if second.to_i > 0
|
91
|
-
ua_pool = [ua_tmp]
|
92
|
-
end
|
93
|
-
|
94
|
-
ua = ua_pool[ rand(ua_pool.size) ]
|
95
|
-
|
96
|
-
ua.to_s
|
97
|
-
|
98
|
-
end
|
99
37
|
|
100
38
|
|
101
39
|
end
|
@@ -26,6 +26,8 @@ module Stella
|
|
26
26
|
|
27
27
|
attr_accessor :working_directory
|
28
28
|
attr_reader :available_agents
|
29
|
+
attr_reader :test_stats
|
30
|
+
attr_reader :rampup_test_stats
|
29
31
|
|
30
32
|
def initialize(testdef=nil, adapter=nil)
|
31
33
|
@testdef = testdef if testdef
|
@@ -40,23 +42,15 @@ module Stella
|
|
40
42
|
@paths = []
|
41
43
|
@format = 'yaml'
|
42
44
|
@agents = []
|
45
|
+
@verbose = 0
|
43
46
|
|
44
|
-
|
47
|
+
ua_path = File.join(STELLA_HOME, 'support', 'useragents.txt')
|
48
|
+
Stella::LOGGER.debug("LOADING #{ua_path}")
|
49
|
+
|
50
|
+
@available_agents = Stella::Util.process_useragents(ua_path)
|
45
51
|
end
|
46
52
|
|
47
|
-
def index_available_agents(path)
|
48
|
-
Stella::LOGGER.debug("LOADING #{path}")
|
49
|
-
return [] unless File.exists?(path)
|
50
|
-
Stella::Util.process_useragents(FileUtil.read_file_to_array(path))
|
51
|
-
end
|
52
53
|
|
53
|
-
def translate_requested_agents(possible_agents=[])
|
54
|
-
agents = []
|
55
|
-
possible_agents.each do |a|
|
56
|
-
agents << find_agent(*a)
|
57
|
-
end
|
58
|
-
agents
|
59
|
-
end
|
60
54
|
|
61
55
|
def run
|
62
56
|
|
@@ -69,11 +63,11 @@ module Stella
|
|
69
63
|
return
|
70
64
|
end
|
71
65
|
|
72
|
-
@agents =
|
66
|
+
@agents = Stella::Util.find_agents(@available_agents, @testdef.agents)
|
73
67
|
|
74
|
-
test_path = _generate_test_path
|
68
|
+
@test_path = _generate_test_path
|
75
69
|
|
76
|
-
prepare_test(test_path)
|
70
|
+
prepare_test(@test_path)
|
77
71
|
|
78
72
|
threshold = (@testdef.rampup) ? @testdef.rampup.ceiling : @adapter.vusers
|
79
73
|
|
@@ -120,7 +114,7 @@ module Stella
|
|
120
114
|
|
121
115
|
# Rampup tests produce multiple summary files which include the batch
|
122
116
|
# number. Regular runs have just one file we set here as the default.
|
123
|
-
summary_name = "
|
117
|
+
summary_name = "STATS"
|
124
118
|
|
125
119
|
# It's possible for the interval to not divide evenly into the ceiling
|
126
120
|
# If we have room between the current number of virtual users and the
|
@@ -133,14 +127,14 @@ module Stella
|
|
133
127
|
@adapter.vusers += @testdef.rampup.interval
|
134
128
|
end
|
135
129
|
padded_users = @adapter.vusers.to_s.rjust(4, '0')
|
136
|
-
summary_name
|
130
|
+
summary_name << "-#{padded_users}"
|
137
131
|
end
|
138
132
|
|
139
133
|
# Read the run summaries for this batch and produce totals, averages,
|
140
134
|
# and standard deviations.
|
141
|
-
test_stats = process_test_stats(@test_runpaths)
|
135
|
+
@test_stats = process_test_stats(@test_runpaths)
|
142
136
|
print_summary(test_stats) if (@testdef.repetitions > 1)
|
143
|
-
save_summary(File.join(test_path, "#{summary_name}.#{@format}"), test_stats)
|
137
|
+
save_summary(File.join(test_path, "#{summary_name}.#{@format}"), @test_stats)
|
144
138
|
|
145
139
|
|
146
140
|
# Non-rampup tests only need to run through the loop once.
|
@@ -152,22 +146,22 @@ module Stella
|
|
152
146
|
# Notice the difference between these test stats and the ones above?
|
153
147
|
# These stats are based on the entire rampup test, across all levels
|
154
148
|
# of virtual users.
|
155
|
-
|
156
|
-
save_summary(File.join(test_path, "
|
149
|
+
@rampup_test_stats = process_test_stats(@all_runpaths)
|
150
|
+
save_summary(File.join(test_path, "STATS.#{@format}"), @rampup_test_stats)
|
157
151
|
print_summary(test_stats) if (@testdef.repetitions > 1)
|
158
152
|
end
|
159
153
|
rescue Interrupt
|
160
|
-
puts "HIHIHI2222"
|
161
154
|
exit
|
162
155
|
rescue AdapterError => ex
|
163
156
|
Stella::LOGGER.error(ex.message)
|
164
157
|
end
|
165
158
|
|
166
|
-
def
|
159
|
+
def test_path_symlink
|
167
160
|
return unless @working_directory
|
168
161
|
File.join(@working_directory, 'latest')
|
169
162
|
end
|
170
163
|
|
164
|
+
|
171
165
|
private
|
172
166
|
|
173
167
|
# prepare_test
|
@@ -185,8 +179,10 @@ module Stella
|
|
185
179
|
# Make sure the test storage directory is created along with the
|
186
180
|
# latest symlink
|
187
181
|
FileUtil.create_dir(test_path)
|
188
|
-
|
189
|
-
|
182
|
+
if Stella.sysinfo.os == :unix
|
183
|
+
File.unlink(test_path_symlink) if File.exists?(test_path_symlink)
|
184
|
+
File.symlink(File.expand_path(test_path), test_path_symlink)
|
185
|
+
end
|
190
186
|
|
191
187
|
# Write the test ID to the storage directory
|
192
188
|
# NOTE: Disabled until we resolve the issue with JRuby on OSX (won't load openssl)
|
@@ -267,7 +263,9 @@ module Stella
|
|
267
263
|
raise AdapterError.new(@adapter.name, @adapter.error)
|
268
264
|
end
|
269
265
|
|
270
|
-
|
266
|
+
@adapter.after
|
267
|
+
|
268
|
+
stats = @adapter.summary
|
271
269
|
|
272
270
|
save_summary(@adapter.summary_path(@format), stats)
|
273
271
|
|
@@ -289,6 +287,7 @@ module Stella
|
|
289
287
|
# INPUT:
|
290
288
|
# stats:: Any object that extends Stella::Test::Base object
|
291
289
|
def print_summary(stats)
|
290
|
+
return if stats.nil?
|
292
291
|
Stella::LOGGER.info(' ' << "-"*67) unless @quiet
|
293
292
|
|
294
293
|
Stella::LOGGER.info_printf("%8s: %10d@%-6d %3.0f%% %9.2f/s ", "Total", stats.transactions_total || 0, stats.vusers_avg || 0, stats.availability || 0, stats.transaction_rate_avg || 0)
|
@@ -320,22 +319,21 @@ module Stella
|
|
320
319
|
# filepath:: the complete path for the file (string)
|
321
320
|
# stats:: Any object that extends Stella::Test::Base object
|
322
321
|
def save_summary(filepath, stats)
|
323
|
-
|
322
|
+
return unless stats
|
323
|
+
stats.format = @format
|
324
|
+
stats.to_file(filepath)
|
324
325
|
end
|
325
326
|
|
326
327
|
# Load SUMMARY file for each run and create a summary with
|
327
328
|
# totals, averages, and standard deviations.
|
328
329
|
def process_test_stats(paths)
|
329
330
|
return unless paths && !paths.empty?
|
330
|
-
test_stats = Stella::Test::
|
331
|
-
|
332
|
-
all_stats_obj = []
|
331
|
+
test_stats = Stella::Test::Stats.new(@message)
|
332
|
+
|
333
333
|
paths.each do |path|
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
stats_obj = Stella::Test::Run::Summary.from_hash(stats)
|
338
|
-
test_stats.add_run(stats_obj)
|
334
|
+
next unless File.exists?("#{path}/SUMMARY.#{@format}")
|
335
|
+
test_run = Stella::Test::Run::Summary.from_file("#{path}/SUMMARY.#{@format}")
|
336
|
+
test_stats.add_run(test_run)
|
339
337
|
end
|
340
338
|
|
341
339
|
test_stats
|
@@ -354,6 +352,7 @@ module Stella
|
|
354
352
|
end
|
355
353
|
|
356
354
|
|
355
|
+
|
357
356
|
end
|
358
357
|
end
|
359
358
|
|
data/lib/stella/data/domain.rb
CHANGED
@@ -2,9 +2,15 @@
|
|
2
2
|
|
3
3
|
module Stella::Data
|
4
4
|
class DomainRequest < Stella::Storable
|
5
|
-
attr_accessor :
|
5
|
+
attr_accessor :dns_data
|
6
6
|
attr_reader :raw_data
|
7
|
-
|
7
|
+
|
8
|
+
field :time => DateTime
|
9
|
+
field :client_ip => String
|
10
|
+
field :server_ip => String
|
11
|
+
field :domain_name => String
|
12
|
+
field :header => String
|
13
|
+
|
8
14
|
def initialize(raw_data)
|
9
15
|
@raw_data = raw_data
|
10
16
|
@dns_data, @domain_name, @header = DomainUtil::parse_domain_request(@raw_data)
|
@@ -20,10 +26,6 @@ module Stella::Data
|
|
20
26
|
false
|
21
27
|
end
|
22
28
|
|
23
|
-
def field_names
|
24
|
-
[ :time, :client_ip, :server_ip, :domain_name, :header ]
|
25
|
-
end
|
26
|
-
|
27
29
|
def to_s
|
28
30
|
"%s: %s -> %s (%s)" % [@time, @client_ip, @server_ip, @domain_name]
|
29
31
|
end
|
@@ -39,8 +41,17 @@ module Stella::Data
|
|
39
41
|
end
|
40
42
|
|
41
43
|
class DomainResponse < Stella::Storable
|
42
|
-
attr_accessor :
|
44
|
+
attr_accessor :dns_data
|
43
45
|
attr_reader :raw_data
|
46
|
+
|
47
|
+
field :time => DateTime
|
48
|
+
field :client_ip => String
|
49
|
+
field :server_ip => String
|
50
|
+
field :domain_name => String
|
51
|
+
field :header => String
|
52
|
+
field :addresses => Array
|
53
|
+
field :cnames => Array
|
54
|
+
|
44
55
|
|
45
56
|
def initialize(raw_data)
|
46
57
|
@raw_data = raw_data
|
@@ -57,10 +68,6 @@ module Stella::Data
|
|
57
68
|
false
|
58
69
|
end
|
59
70
|
|
60
|
-
def field_names
|
61
|
-
[ :time, :client_ip, :server_ip, :dns_data, :domain_name, :header, :addresses, :cnames ]
|
62
|
-
end
|
63
|
-
|
64
71
|
def to_s
|
65
72
|
"%s: %s <- %s (%s) %s" % [@time, @client_ip, @server_ip, @domain_name, (@addresses || []).join(',')]
|
66
73
|
end
|
data/lib/stella/data/http.rb
CHANGED
@@ -17,10 +17,16 @@ module Stella::Data
|
|
17
17
|
end
|
18
18
|
|
19
19
|
class HTTPRequest < Stella::Storable
|
20
|
-
attr_accessor :time, :client_ip, :server_ip, :header, :body, :method, :http_version
|
21
20
|
attr_reader :raw_data
|
22
|
-
|
23
|
-
|
21
|
+
|
22
|
+
field :time => DateTime
|
23
|
+
field :client_ip
|
24
|
+
field :server_ip
|
25
|
+
field :header
|
26
|
+
field :uri
|
27
|
+
field :body
|
28
|
+
field :http_method
|
29
|
+
field :http_version
|
24
30
|
|
25
31
|
def has_body?
|
26
32
|
@body && !@body.nil & !@body.empty?
|
@@ -35,7 +41,7 @@ module Stella::Data
|
|
35
41
|
def initialize(raw_data=nil)
|
36
42
|
@raw_data = raw_data
|
37
43
|
if @raw_data
|
38
|
-
@
|
44
|
+
@http_method, @http_version, @uri, @header, @body = HTTPUtil::parse_http_request(raw_data)
|
39
45
|
end
|
40
46
|
@response = Stella::Data::HTTPResponse.new
|
41
47
|
end
|
@@ -51,32 +57,37 @@ module Stella::Data
|
|
51
57
|
#(!header || header[:Content_Type] || header[:Content_Type] !~ /text/) ? Base64.encode64(@body) : @body
|
52
58
|
end
|
53
59
|
|
54
|
-
|
55
|
-
[ :time, :client_ip, :server_ip, :header, :uri, :body, :method, :http_version ]
|
56
|
-
end
|
60
|
+
|
57
61
|
|
58
62
|
def inspect
|
59
63
|
headers = []
|
60
64
|
header.each_pair do |n,v|
|
61
65
|
headers << "#{n.to_s.gsub('_', '-')}: #{v[0]}"
|
62
66
|
end
|
63
|
-
str = "%s %s HTTP/%s" % [
|
67
|
+
str = "%s %s HTTP/%s" % [http_method, uri.to_s, http_version]
|
64
68
|
str << $/ + headers.join($/)
|
65
69
|
str << $/ + $/ + body if body
|
66
70
|
str
|
67
71
|
end
|
68
72
|
|
69
73
|
def to_s
|
70
|
-
str = "%s: %s %s HTTP/%s" % [time.strftime(NICE_TIME_FORMAT),
|
74
|
+
str = "%s: %s %s HTTP/%s" % [time.strftime(NICE_TIME_FORMAT), http_method, uri.to_s, http_version]
|
71
75
|
str
|
72
76
|
end
|
73
77
|
|
74
78
|
end
|
75
79
|
|
76
80
|
class HTTPResponse < Stella::Storable
|
77
|
-
attr_accessor :time, :client_ip, :server_ip, :header, :status, :message, :http_version
|
78
81
|
attr_reader :raw_data
|
79
|
-
|
82
|
+
|
83
|
+
field :time => DateTime
|
84
|
+
field :client_ip => String
|
85
|
+
field :server_ip => String
|
86
|
+
field :header => String
|
87
|
+
field :body => String
|
88
|
+
field :status => String
|
89
|
+
field :message => String
|
90
|
+
field :http_version => String
|
80
91
|
|
81
92
|
def initialize(raw_data=nil)
|
82
93
|
@raw_data = raw_data
|
@@ -86,7 +97,7 @@ module Stella::Data
|
|
86
97
|
end
|
87
98
|
|
88
99
|
def has_body?
|
89
|
-
@body && !@body.nil & !@body.empty?
|
100
|
+
@body && !@body.nil? & !@body.empty?
|
90
101
|
end
|
91
102
|
def has_request?
|
92
103
|
false
|
@@ -101,10 +112,6 @@ module Stella::Data
|
|
101
112
|
(!header || !header[:Content_Type] || header[:Content_Type] !~ /text/) ? '' : @body
|
102
113
|
end
|
103
114
|
|
104
|
-
def field_names
|
105
|
-
[ :time, :client_ip, :server_ip, :header, :body, :status, :message, :http_version ]
|
106
|
-
end
|
107
|
-
|
108
115
|
def inspect
|
109
116
|
headers = []
|
110
117
|
header.each_pair do |n,v|
|