stella 0.7.4.001 → 0.7.5.001
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES.txt +13 -0
- data/lib/stella.rb +5 -4
- data/lib/stella/cli.rb +0 -2
- data/lib/stella/client.rb +42 -35
- data/lib/stella/data/http.rb +6 -4
- data/lib/stella/engine.rb +1 -2
- data/lib/stella/engine/load_queue.rb +2 -2
- data/lib/stella/engine/loadbase.rb +33 -23
- data/lib/stella/logger.rb +1 -4
- data/lib/stella/testplan.rb +24 -19
- data/stella.gemspec +2 -2
- metadata +3 -3
data/CHANGES.txt
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
STELLA, CHANGES
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
#### 0.7.5 (2009-11-16) ###############################
|
|
5
|
+
|
|
6
|
+
* FIXED: Correctly capture exceptions in Client
|
|
7
|
+
* FIXED: Issue with printing the dot (.) for the start of every usecase
|
|
8
|
+
* FIXED: Stats samples not cleared between background calculations
|
|
9
|
+
* CHANGE: Do not include testplan, usecase, or request descriptions in digest calculation
|
|
10
|
+
* CHANGE: Use 6 digit digest in log directory names
|
|
11
|
+
* CHANGE: Client aborts usecase on unhandled exceptions
|
|
12
|
+
* ADDED: Support for $perlstyle variables in config
|
|
13
|
+
* ADDED: Print log dir below summary report
|
|
14
|
+
|
|
15
|
+
|
|
3
16
|
#### 0.7.4 (2009-11-11) ###############################
|
|
4
17
|
|
|
5
18
|
* FIXED: Proper handling for timeout errors
|
data/lib/stella.rb
CHANGED
|
@@ -21,7 +21,7 @@ module Stella
|
|
|
21
21
|
unless defined?(MAJOR)
|
|
22
22
|
MAJOR = 0.freeze
|
|
23
23
|
MINOR = 7.freeze
|
|
24
|
-
TINY =
|
|
24
|
+
TINY = 5.freeze
|
|
25
25
|
PATCH = '001'.freeze
|
|
26
26
|
end
|
|
27
27
|
def self.to_s; [MAJOR, MINOR, TINY].join('.'); end
|
|
@@ -65,7 +65,8 @@ module Stella
|
|
|
65
65
|
def le(*msg); stdout.info " " << msg.join("#{$/} ").color(:red); end
|
|
66
66
|
def ld(*msg)
|
|
67
67
|
return unless Stella.debug?
|
|
68
|
-
|
|
68
|
+
prefix = "D(#{Thread.current.object_id}): "
|
|
69
|
+
Stella.stdout.info "#{prefix}" << msg.join("#{$/}#{prefix}")
|
|
69
70
|
end
|
|
70
71
|
|
|
71
72
|
def sysinfo
|
|
@@ -92,8 +93,8 @@ module Stella
|
|
|
92
93
|
def rescue(&blk)
|
|
93
94
|
blk.call
|
|
94
95
|
rescue => ex
|
|
95
|
-
Stella.
|
|
96
|
-
Stella.
|
|
96
|
+
Stella.le "ERROR: #{ex.message}"
|
|
97
|
+
Stella.ld ex.backtrace
|
|
97
98
|
end
|
|
98
99
|
|
|
99
100
|
require 'stella/common'
|
data/lib/stella/cli.rb
CHANGED
|
@@ -41,8 +41,6 @@ class Stella::CLI < Drydock::Command
|
|
|
41
41
|
ret = Stella::Engine::LoadPackage.run @testplan, opts
|
|
42
42
|
when "create"
|
|
43
43
|
ret = Stella::Engine::LoadCreate.run @testplan, opts
|
|
44
|
-
when "redis"
|
|
45
|
-
ret = Stella::Engine::LoadRedis.run @testplan, opts
|
|
46
44
|
else
|
|
47
45
|
ret = Stella::Engine::LoadQueue.run @testplan, opts
|
|
48
46
|
end
|
data/lib/stella/client.rb
CHANGED
|
@@ -40,42 +40,50 @@ module Stella
|
|
|
40
40
|
stats ||= Benelux::Stats.new
|
|
41
41
|
update(:prepare_request, usecase, req, counter)
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
begin
|
|
44
|
+
# This is for the values that were "set"
|
|
45
|
+
# in the part before the response body.
|
|
46
|
+
prepare_resources(container, req.resources)
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
params = prepare_params(container, req.params)
|
|
49
|
+
headers = prepare_headers(container, req.headers)
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
container.params, container.headers = params, headers
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
uri = build_request_uri req.uri, params, container
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
if http_auth = usecase.http_auth || req.http_auth
|
|
56
|
+
# TODO: The first arg is domain and can include a URI path.
|
|
57
|
+
# Are there cases where this is important?
|
|
58
|
+
domain = '%s://%s%s' % [uri.scheme, uri.host, '/'] #File.dirname(uri.path)
|
|
59
|
+
user, pass = http_auth.user, http_auth.pass
|
|
60
|
+
user = container.instance_eval &user if Proc === user
|
|
61
|
+
pass = container.instance_eval &pass if Proc === pass
|
|
62
|
+
update(:authenticate, usecase, req, http_auth.kind, domain, user, pass)
|
|
63
|
+
http_client.set_auth(domain, user, pass)
|
|
64
|
+
end
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
raise NoHostDefined, req.uri if uri.host.nil? || uri.host.empty?
|
|
67
|
+
stella_id = [Time.now.to_f, self.digest_cache, req.digest_cache, params, headers, counter].gibbler
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
Benelux.add_thread_tags :request => req.digest_cache
|
|
70
|
+
Benelux.add_thread_tags :retry => counter
|
|
71
|
+
Benelux.add_thread_tags :stella_id => stella_id
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
container.unique_id = stella_id
|
|
74
|
+
params['__stella'] = headers['X-Stella-ID'] = container.unique_id[0..10]
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
meth = req.http_method.to_s.downcase
|
|
77
|
+
Stella.ld "#{req.http_method}: " << "#{req.uri} " << params.inspect
|
|
78
|
+
|
|
79
|
+
ret, asset_duration = nil, 0
|
|
80
|
+
rescue => ex
|
|
81
|
+
update(:request_unhandled_exception, usecase, uri, req, params, ex)
|
|
82
|
+
update(:usecase_error, ex.message, uri, container)
|
|
83
|
+
Benelux.remove_thread_tags :status, :retry, :request, :stella_id
|
|
84
|
+
break
|
|
85
|
+
end
|
|
77
86
|
|
|
78
|
-
ret, asset_duration = nil, 0
|
|
79
87
|
begin
|
|
80
88
|
send_request http_client, usecase, meth, uri, req, params, headers, container, counter
|
|
81
89
|
update(:receive_response, usecase, uri, req, params, headers, counter, container)
|
|
@@ -101,8 +109,8 @@ module Stella
|
|
|
101
109
|
asset_duration = Time.now - asset_start
|
|
102
110
|
rescue HTTPClient::ConnectTimeoutError => ex
|
|
103
111
|
update(:request_timeout, usecase, uri, req, params, headers, counter, container)
|
|
112
|
+
Benelux.remove_thread_tags :status, :retry, :request, :stella_id
|
|
104
113
|
rescue => ex
|
|
105
|
-
#p "111111111111111111111111#{ex.class}: #{ex.message}"
|
|
106
114
|
update(:request_unhandled_exception, usecase, uri, req, params, ex)
|
|
107
115
|
Benelux.remove_thread_tags :status, :retry, :request, :stella_id
|
|
108
116
|
next
|
|
@@ -210,14 +218,13 @@ module Stella
|
|
|
210
218
|
def build_request_uri(uri, params, container)
|
|
211
219
|
newuri = uri.clone # don't modify uri template
|
|
212
220
|
# We call uri.clone b/c we modify uri.
|
|
213
|
-
uri.scan(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
end
|
|
221
|
+
uri.scan(/([:\$])([a-z_]+)/i) do |inst|
|
|
222
|
+
val = find_replacement_value(inst[1], params, container, base_uri)
|
|
223
|
+
Stella.ld "FOUND VAR: #{inst[0]}#{inst[1]} (value: #{val})"
|
|
224
|
+
re = Regexp.new "\\#{inst[0]}#{inst[1]}"
|
|
225
|
+
newuri.gsub! re, val.to_s unless val.nil?
|
|
219
226
|
end
|
|
220
|
-
|
|
227
|
+
|
|
221
228
|
uri = URI.parse(newuri)
|
|
222
229
|
|
|
223
230
|
if uri.host.nil? && base_uri.nil?
|
data/lib/stella/data/http.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Stella::Data::HTTP
|
|
|
14
14
|
#
|
|
15
15
|
attr_accessor :response_handler
|
|
16
16
|
|
|
17
|
-
field :
|
|
17
|
+
field :description
|
|
18
18
|
field :header
|
|
19
19
|
field :uri
|
|
20
20
|
field :wait
|
|
@@ -25,6 +25,8 @@ module Stella::Data::HTTP
|
|
|
25
25
|
field :content_type
|
|
26
26
|
field :http_auth
|
|
27
27
|
|
|
28
|
+
attic :description
|
|
29
|
+
|
|
28
30
|
def has_body?
|
|
29
31
|
!@body.nil?
|
|
30
32
|
end
|
|
@@ -35,7 +37,7 @@ module Stella::Data::HTTP
|
|
|
35
37
|
@headers, @params, @response_handler = {}, {}, {}
|
|
36
38
|
@resources = {}
|
|
37
39
|
@wait = 0
|
|
38
|
-
|
|
40
|
+
self.description = "Request"
|
|
39
41
|
instance_eval &definition unless definition.nil?
|
|
40
42
|
end
|
|
41
43
|
|
|
@@ -45,8 +47,8 @@ module Stella::Data::HTTP
|
|
|
45
47
|
end
|
|
46
48
|
|
|
47
49
|
def desc(*args)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
self.description = args.first unless args.empty?
|
|
51
|
+
self.description
|
|
50
52
|
end
|
|
51
53
|
|
|
52
54
|
def content_type(*args)
|
data/lib/stella/engine.rb
CHANGED
|
@@ -25,7 +25,7 @@ module Stella::Engine
|
|
|
25
25
|
|
|
26
26
|
def log_dir(plan, file=nil)
|
|
27
27
|
stamp = Stella::START_TIME.strftime("%Y%m%d-%H-%M-%S")
|
|
28
|
-
stamp <<"-#{plan.digest.
|
|
28
|
+
stamp <<"-#{plan.digest.shorter}"
|
|
29
29
|
#stamp << "STAMP"
|
|
30
30
|
l = File.join Stella::Config.project_dir, 'log', stamp
|
|
31
31
|
FileUtils.mkdir_p l unless File.exists? l
|
|
@@ -86,7 +86,6 @@ module Stella::Engine
|
|
|
86
86
|
autoload :LoadPackage, 'stella/engine/load_package'
|
|
87
87
|
autoload :LoadCreate, 'stella/engine/load_create'
|
|
88
88
|
autoload :LoadQueue, 'stella/engine/load_queue'
|
|
89
|
-
autoload :LoadRedis, 'stella/engine/load_redis'
|
|
90
89
|
|
|
91
90
|
# These timers are interesting from a reporting perspective.
|
|
92
91
|
Benelux.add_counter Stella::Client, :execute_response_handler
|
|
@@ -24,8 +24,8 @@ module Stella::Engine
|
|
|
24
24
|
|
|
25
25
|
# This thread will stay on this one track.
|
|
26
26
|
Benelux.current_track c.digest
|
|
27
|
-
Benelux.add_thread_tags :usecase => uc.digest_cache
|
|
28
27
|
|
|
28
|
+
Benelux.add_thread_tags :usecase => uc.digest_cache
|
|
29
29
|
Thread.current[:real_uctime].first_tick
|
|
30
30
|
prev_ptime ||= Time.now
|
|
31
31
|
reps.times { |rep|
|
|
@@ -38,7 +38,7 @@ module Stella::Engine
|
|
|
38
38
|
#Stella.stdout.info [package.client.gibbler.shorter, package.usecase.gibbler.shorter, rep].inspect
|
|
39
39
|
Stella::Engine::Load.rescue(c.digest_cache) {
|
|
40
40
|
break if Stella.abort?
|
|
41
|
-
Stella.stdout.
|
|
41
|
+
print '.' if Stella.stdout.lev == 2
|
|
42
42
|
stats = c.execute uc
|
|
43
43
|
}
|
|
44
44
|
Benelux.remove_thread_tags :rep
|
|
@@ -7,9 +7,10 @@ module Stella::Engine
|
|
|
7
7
|
@timers = [:do_request]
|
|
8
8
|
@counts = [:response_content_size]
|
|
9
9
|
@reqlog = nil
|
|
10
|
+
@logdir = nil
|
|
10
11
|
|
|
11
12
|
class << self
|
|
12
|
-
attr_accessor :timers, :counts
|
|
13
|
+
attr_accessor :timers, :counts, :logdir
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
def run(plan, opts={})
|
|
@@ -17,13 +18,13 @@ module Stella::Engine
|
|
|
17
18
|
opts = process_options! plan, opts
|
|
18
19
|
@threads, @max_clients, @real_reps = [], 0, 0
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
latest = File.join(File.dirname(
|
|
22
|
-
Stella.stdout.info "Logging to #{
|
|
21
|
+
@logdir = log_dir(plan)
|
|
22
|
+
latest = File.join(File.dirname(@logdir), 'latest')
|
|
23
|
+
Stella.stdout.info "Logging to #{@logdir}", $/
|
|
23
24
|
|
|
24
25
|
if Stella.sysinfo.os == :unix
|
|
25
26
|
File.unlink latest if File.exists? latest
|
|
26
|
-
FileUtils.ln_sf File.basename(
|
|
27
|
+
FileUtils.ln_sf File.basename(@logdir), latest
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
@reqlog = Stella::Logger.new log_path(plan, 'requests')
|
|
@@ -39,8 +40,7 @@ module Stella::Engine
|
|
|
39
40
|
@plalog.info(plan.pretty.noansi) and @plalog.close
|
|
40
41
|
|
|
41
42
|
|
|
42
|
-
Stella.stdout.add_template :
|
|
43
|
-
Stella.stdout.add_template :head2, ' %s: %s'
|
|
43
|
+
Stella.stdout.add_template :head, ' %s: %s'
|
|
44
44
|
Stella.stdout.add_template :status, "#{$/}%s..."
|
|
45
45
|
|
|
46
46
|
@sumlog.add_template :dsummary, '%20s: %8d'
|
|
@@ -69,9 +69,9 @@ module Stella::Engine
|
|
|
69
69
|
timing = "#{opts[:repetitions]} repetitions"
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
-
Stella.stdout.
|
|
73
|
-
Stella.stdout.
|
|
74
|
-
Stella.stdout.
|
|
72
|
+
Stella.stdout.head 'Plan', "#{plan.desc} (#{plan.digest.shorter})"
|
|
73
|
+
Stella.stdout.head 'Clients', counts[:total]
|
|
74
|
+
Stella.stdout.head 'Limit', timing
|
|
75
75
|
|
|
76
76
|
@dumper.start
|
|
77
77
|
|
|
@@ -79,7 +79,7 @@ module Stella::Engine
|
|
|
79
79
|
@optlog.head "START", Time.now.to_s
|
|
80
80
|
Stella.stdout.status "Running"
|
|
81
81
|
execute_test_plan packages, opts[:repetitions], opts[:duration], opts[:arrival]
|
|
82
|
-
Stella.stdout.info "Done"
|
|
82
|
+
Stella.stdout.info $/, "Done"
|
|
83
83
|
rescue Interrupt
|
|
84
84
|
Stella.stdout.nstatus "Stopping test"
|
|
85
85
|
Stella.abort!
|
|
@@ -127,6 +127,8 @@ module Stella::Engine
|
|
|
127
127
|
# DNE:
|
|
128
128
|
#p [@real_reps, total.n]
|
|
129
129
|
|
|
130
|
+
Stella.stdout.info $/, "Log dir: #{@logdir}"
|
|
131
|
+
|
|
130
132
|
failed.n == 0
|
|
131
133
|
end
|
|
132
134
|
|
|
@@ -142,14 +144,13 @@ module Stella::Engine
|
|
|
142
144
|
|
|
143
145
|
def prepare_dumper(plan, opts)
|
|
144
146
|
Stella::Hand.new(15.seconds, 2.seconds) do
|
|
145
|
-
Benelux.update_global_timeline
|
|
147
|
+
Benelux.update_global_timeline
|
|
146
148
|
#reqlog.info [Time.now, Benelux.timeline.size].inspect
|
|
147
149
|
@reqlog.info Benelux.timeline.messages.filter(:kind => :request)
|
|
148
150
|
@failog.info Benelux.timeline.messages.filter(:kind => :exception)
|
|
149
151
|
@failog.info Benelux.timeline.messages.filter(:kind => :timeout)
|
|
150
152
|
@authlog.info Benelux.timeline.messages.filter(:kind => :authentication)
|
|
151
153
|
@reqlog.clear and @failog.clear and @authlog.clear
|
|
152
|
-
#generate_runtime_report(plan)
|
|
153
154
|
Benelux.timeline.clear if opts[:"disable-stats"]
|
|
154
155
|
end
|
|
155
156
|
|
|
@@ -223,7 +224,6 @@ module Stella::Engine
|
|
|
223
224
|
end
|
|
224
225
|
|
|
225
226
|
def generate_report(sumlog,plan,test_time)
|
|
226
|
-
#Benelux.update_all_track_timelines
|
|
227
227
|
global_timeline = Benelux.timeline
|
|
228
228
|
global_stats = global_timeline.stats.group(:do_request).merge
|
|
229
229
|
if global_stats.n == 0
|
|
@@ -231,6 +231,8 @@ module Stella::Engine
|
|
|
231
231
|
return
|
|
232
232
|
end
|
|
233
233
|
|
|
234
|
+
|
|
235
|
+
|
|
234
236
|
@sumlog.info " %-72s ".att(:reverse) % ["#{plan.desc} (#{plan.digest_cache.shorter})"]
|
|
235
237
|
plan.usecases.uniq.each_with_index do |uc,i|
|
|
236
238
|
|
|
@@ -350,16 +352,22 @@ module Stella::Engine
|
|
|
350
352
|
|
|
351
353
|
def update_error_execute_response_handler(client_id, ex, req, container)
|
|
352
354
|
desc = "#{container.usecase.desc} > #{req.desc}"
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
355
|
+
if Stella.stdout.lev == 2
|
|
356
|
+
Stella.stdout.print 2, '.'.color(:red)
|
|
357
|
+
else
|
|
358
|
+
Stella.le ' Client-%s %-45s %s' % [client_id.shorter, desc, ex.message]
|
|
359
|
+
Stella.ld ex.backtrace
|
|
360
|
+
end
|
|
356
361
|
end
|
|
357
362
|
|
|
358
363
|
def update_request_unhandled_exception(client_id, usecase, uri, req, params, ex)
|
|
359
364
|
desc = "#{usecase.desc} > #{req.desc}"
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
365
|
+
if Stella.stdout.lev == 2
|
|
366
|
+
Stella.stdout.print 2, '.'.color(:red)
|
|
367
|
+
else
|
|
368
|
+
Stella.le ' Client-%s %-45s %s' % [client_id.shorter, desc, ex.message]
|
|
369
|
+
Stella.ld ex.backtrace
|
|
370
|
+
end
|
|
363
371
|
end
|
|
364
372
|
|
|
365
373
|
def update_usecase_quit client_id, msg, req, container
|
|
@@ -383,7 +391,9 @@ module Stella::Engine
|
|
|
383
391
|
Benelux.thread_timeline.add_count :error, 1
|
|
384
392
|
args.push [req, container.status, 'ERROR', msg, container.unique_id[0,10]]
|
|
385
393
|
Benelux.thread_timeline.add_message args.join('; '), :kind => :exception
|
|
386
|
-
Stella.stdout.
|
|
394
|
+
if Stella.stdout.lev >= 3
|
|
395
|
+
Stella.le ' Client-%s %-45s %s' % [client_id.shorter, desc, ex.message]
|
|
396
|
+
end
|
|
387
397
|
end
|
|
388
398
|
|
|
389
399
|
def update_request_repeat client_id, counter, total, req, container
|
|
@@ -407,8 +417,8 @@ module Stella::Engine
|
|
|
407
417
|
def self.rescue(client_id, &blk)
|
|
408
418
|
blk.call
|
|
409
419
|
rescue => ex
|
|
410
|
-
Stella.
|
|
411
|
-
|
|
420
|
+
Stella.le ' Error in Client-%s: %s' % [client_id.shorter, ex.message]
|
|
421
|
+
Stella.ld ex.backtrace
|
|
412
422
|
end
|
|
413
423
|
|
|
414
424
|
Benelux.add_timer Stella::Engine::Load, :build_thread_package
|
data/lib/stella/logger.rb
CHANGED
|
@@ -40,10 +40,6 @@ module Stella
|
|
|
40
40
|
flush if autoflush?
|
|
41
41
|
true
|
|
42
42
|
end
|
|
43
|
-
def print!(level, msg)
|
|
44
|
-
return unless @lev == level
|
|
45
|
-
print level, msg
|
|
46
|
-
end
|
|
47
43
|
|
|
48
44
|
def puts(level, *msg)
|
|
49
45
|
return if level > @lev || Logger.disabled?
|
|
@@ -83,6 +79,7 @@ module Stella
|
|
|
83
79
|
end
|
|
84
80
|
end
|
|
85
81
|
|
|
82
|
+
# TODO: There's a big when using print (no newline)
|
|
86
83
|
def flush
|
|
87
84
|
return if Logger.disabled?
|
|
88
85
|
@mutex.synchronize do
|
data/lib/stella/testplan.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
autoload :CSV, 'csv'
|
|
2
|
+
#Gibbler.enable_debug
|
|
2
3
|
|
|
3
4
|
module Stella
|
|
4
5
|
class Testplan
|
|
@@ -21,13 +22,14 @@ class Testplan
|
|
|
21
22
|
|
|
22
23
|
attic :base_path
|
|
23
24
|
attic :plan_path
|
|
25
|
+
attic :description
|
|
24
26
|
|
|
25
27
|
attr_accessor :usecases
|
|
26
|
-
attr_accessor :desc
|
|
27
28
|
attr_reader :stats
|
|
28
29
|
|
|
29
30
|
def initialize(uris=[], opts={})
|
|
30
|
-
|
|
31
|
+
self.description = "Test plan"
|
|
32
|
+
@usecases = []
|
|
31
33
|
@testplan_current_ratio = 0
|
|
32
34
|
@stats = Stella::Testplan::Stats.new
|
|
33
35
|
|
|
@@ -62,8 +64,6 @@ class Testplan
|
|
|
62
64
|
needy.each do |u|
|
|
63
65
|
u.ratio = (remaining_ratio / needy.size).to_f
|
|
64
66
|
end
|
|
65
|
-
# Give usecases a name if necessary
|
|
66
|
-
@usecases.each_with_index { |uc,i| uc.desc ||= "Usecase ##{i+1}" }
|
|
67
67
|
if @testplan_current_ratio > 1.0
|
|
68
68
|
msg = "Usecase ratio cannot be higher than 1.0"
|
|
69
69
|
msg << " (#{@testplan_current_ratio})"
|
|
@@ -73,45 +73,49 @@ class Testplan
|
|
|
73
73
|
|
|
74
74
|
# make sure all clients share identical test plans
|
|
75
75
|
def freeze
|
|
76
|
-
Stella.ld "FREEZE TESTPLAN: #{
|
|
76
|
+
Stella.ld "FREEZE TESTPLAN: #{self.description}"
|
|
77
77
|
@usecases.each { |uc| uc.freeze }
|
|
78
78
|
super
|
|
79
79
|
self
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
def usecase(*args, &blk)
|
|
83
|
-
return @usecases if args.empty?
|
|
83
|
+
return @usecases if args.empty? && blk.nil?
|
|
84
84
|
ratio, name = nil,nil
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
unless args.empty?
|
|
86
|
+
ratio, name = args[0], args[1] if args[0].is_a?(Numeric)
|
|
87
|
+
ratio, name = args[1], args[0] if args[0].is_a?(String)
|
|
88
|
+
end
|
|
87
89
|
uc = Stella::Testplan::Usecase.new
|
|
88
90
|
uc.base_path = self.base_path
|
|
89
91
|
uc.plan_path = self.plan_path
|
|
90
92
|
uc.instance_eval &blk
|
|
91
|
-
uc.ratio
|
|
93
|
+
uc.ratio = (ratio || -1).to_f
|
|
94
|
+
uc.description = name unless name.nil?
|
|
92
95
|
@testplan_current_ratio += uc.ratio if uc.ratio > 0
|
|
93
96
|
add_usecase uc
|
|
94
97
|
end
|
|
95
98
|
def xusecase(*args, &blk); Stella.ld "Skipping usecase"; end
|
|
96
99
|
|
|
97
100
|
def add_usecase(uc)
|
|
98
|
-
Stella.ld "Usecase: #{uc.
|
|
101
|
+
Stella.ld "Usecase: #{uc.description}"
|
|
99
102
|
@usecases << uc
|
|
100
103
|
uc
|
|
101
104
|
end
|
|
102
105
|
|
|
106
|
+
# for DSL use-only (otherwise use: self.description)
|
|
103
107
|
def desc(*args)
|
|
104
|
-
|
|
105
|
-
|
|
108
|
+
self.description = args.first unless args.empty?
|
|
109
|
+
self.description
|
|
106
110
|
end
|
|
107
111
|
|
|
108
112
|
def pretty(long=false)
|
|
109
113
|
str = []
|
|
110
114
|
dig = long ? self.digest_cache : self.digest_cache.shorter
|
|
111
|
-
str << " %-66s ".att(:reverse) % ["#{
|
|
115
|
+
str << " %-66s ".att(:reverse) % ["#{self.description} (#{dig})"]
|
|
112
116
|
@usecases.each_with_index do |uc,i|
|
|
113
117
|
dig = long ? uc.digest_cache : uc.digest_cache.shorter
|
|
114
|
-
desc = uc.
|
|
118
|
+
desc = uc.description || "Usecase ##{i+1}"
|
|
115
119
|
desc += " (#{dig}) "
|
|
116
120
|
str << (' ' << " %-61s %s%% ".att(:reverse).bright) % [desc, uc.ratio_pretty]
|
|
117
121
|
unless uc.http_auth.nil?
|
|
@@ -119,7 +123,7 @@ class Testplan
|
|
|
119
123
|
end
|
|
120
124
|
requests = uc.requests.each do |r|
|
|
121
125
|
dig = long ? r.digest_cache : r.digest_cache.shorter
|
|
122
|
-
str << " %-62s".bright % ["#{r.
|
|
126
|
+
str << " %-62s".bright % ["#{r.description} (#{dig})"]
|
|
123
127
|
str << " %s" % [r]
|
|
124
128
|
if Stella.stdout.lev > 2
|
|
125
129
|
[:wait].each { |i| str << " %s: %s" % [i, r.send(i)] }
|
|
@@ -166,8 +170,9 @@ class Testplan
|
|
|
166
170
|
|
|
167
171
|
attic :base_path # we don't want gibbler to see this
|
|
168
172
|
attic :plan_path
|
|
173
|
+
attic :description
|
|
174
|
+
|
|
169
175
|
|
|
170
|
-
attr_accessor :desc
|
|
171
176
|
attr_writer :ratio
|
|
172
177
|
attr_reader :http_auth
|
|
173
178
|
|
|
@@ -184,8 +189,8 @@ class Testplan
|
|
|
184
189
|
end
|
|
185
190
|
|
|
186
191
|
def desc(*args)
|
|
187
|
-
|
|
188
|
-
|
|
192
|
+
self.description = args.first unless args.empty?
|
|
193
|
+
self.description
|
|
189
194
|
end
|
|
190
195
|
|
|
191
196
|
def resource(name, value=nil)
|
|
@@ -248,7 +253,7 @@ class Testplan
|
|
|
248
253
|
|
|
249
254
|
def add_request(meth, *args, &blk)
|
|
250
255
|
req = Stella::Data::HTTP::Request.new meth.to_s.upcase, args[0], &blk
|
|
251
|
-
req.
|
|
256
|
+
req.description = args[1] if args.size > 1 # Description is optional
|
|
252
257
|
Stella.ld req
|
|
253
258
|
@requests << req
|
|
254
259
|
req
|
data/stella.gemspec
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@spec = Gem::Specification.new do |s|
|
|
2
2
|
s.name = "stella"
|
|
3
3
|
s.rubyforge_project = 'stella'
|
|
4
|
-
s.version = "0.7.
|
|
4
|
+
s.version = "0.7.5.001"
|
|
5
5
|
s.summary = "Blame Stella for breaking your web applications."
|
|
6
6
|
s.description = s.summary
|
|
7
7
|
s.author = "Delano Mandelbaum"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
s.executables = %w[stella]
|
|
17
17
|
|
|
18
|
-
s.add_dependency 'benelux', '>= 0.5.
|
|
18
|
+
s.add_dependency 'benelux', '>= 0.5.3'
|
|
19
19
|
s.add_dependency 'drydock', '>= 0.6.8'
|
|
20
20
|
s.add_dependency 'gibbler', '>= 0.7.1'
|
|
21
21
|
s.add_dependency 'sysinfo', '>= 0.7.1'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stella
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.5.001
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Delano Mandelbaum
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-11-
|
|
12
|
+
date: 2009-11-23 00:00:00 -05:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -20,7 +20,7 @@ dependencies:
|
|
|
20
20
|
requirements:
|
|
21
21
|
- - ">="
|
|
22
22
|
- !ruby/object:Gem::Version
|
|
23
|
-
version: 0.5.
|
|
23
|
+
version: 0.5.3
|
|
24
24
|
version:
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: drydock
|