stella 0.8.3.002 → 0.8.4.001

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.txt CHANGED
@@ -11,6 +11,17 @@ STELLA, CHANGES
11
11
  * TODO: process templates for calls to set in get blocks
12
12
 
13
13
 
14
+ #### 0.8.4 (2010-03-??) ###############################
15
+
16
+ * FIXED: Misc issues getting and setting headers, params, and resources
17
+ * FIXED: There was no response body in Stella::Engine::Log objects
18
+ * CHANGE: Store URIs as strings in Stella::Engine::Log objects
19
+ * CHANGE: Stella::Data::HTTP now uses @header instead of @headers
20
+ * ADDED: Testrun#end_time, Testrun#running?
21
+ * ADDED: Testrun.elapsed_seconds
22
+ * ADDED: Testrun.granularity which replaces Load::ROTATE_TIMELINE
23
+
24
+
14
25
  #### 0.8.3 (2010-03-15) ###############################
15
26
 
16
27
  * FIXED: Testrun digest handling
data/Rakefile CHANGED
@@ -25,9 +25,9 @@ begin
25
25
  gem.email = "delano@solutious.com"
26
26
  gem.homepage = "http://blamestella.com/"
27
27
  gem.authors = ["Delano Mandelbaum"]
28
- gem.add_dependency("gibbler", ">= 0.7.4")
28
+ gem.add_dependency("gibbler", ">= 0.7.6")
29
29
  gem.add_dependency("drydock", ">= 0.6.9")
30
- gem.add_dependency("benelux", ">= 0.5.11")
30
+ gem.add_dependency("benelux", ">= 0.5.12")
31
31
  gem.add_dependency('sysinfo', '>= 0.7.3')
32
32
  gem.add_dependency('storable', '>= 0.6.4')
33
33
  gem.add_dependency("nokogiri")
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :MAJOR: 0
3
3
  :MINOR: 8
4
- :PATCH: 3
5
- :BUILD: '002'
4
+ :PATCH: 4
5
+ :BUILD: '001'
data/bin/stella CHANGED
@@ -85,12 +85,13 @@ class Stella::CLI::Definition
85
85
  about "Preview a test plan"
86
86
  usage "stella preview [-p path/2/testplan.rb] "
87
87
  option :c, :clients, Integer, "Maximum number of virtual clients (ignored)"
88
+ option :a, :arrival, Float, "Arrival rate (ignored)"
88
89
  option :r, :repetitions, Integer, "Number of times to repeat the testplan (ignored)"
89
90
  option :d, :duration, String, "Max duration to run test (ignored)"
90
91
  option :W, :nowait, "Ignore wait times (ignored)"
91
92
  option :w, :wait, Float, "Wait time (in seconds) between client requests (ignored if testplan supplied)"
92
93
  option :p, :testplan, String, "Path to testplan"
93
- option :a, :arrival, Float, "Arrival rate (ignored)"
94
+ option :g, :granularity, Integer, "Amount of time (in seconds) between timeline rotations"
94
95
  command :preview => Stella::CLI
95
96
 
96
97
  about "Verify a test plan"
@@ -98,12 +99,13 @@ class Stella::CLI::Definition
98
99
  usage "e.g."
99
100
  usage " $ stella verify -p path/2/testplan.rb http://stellaaahhhh.com/"
100
101
  option :c, :clients, Integer, "Maximum number of virtual clients (ignored)"
102
+ option :a, :arrival, Float, "Arrival rate (ignored)"
101
103
  option :r, :repetitions, Integer, "Number of times to repeat the testplan (ignored)"
102
104
  option :d, :duration, String, "Max duration to run test (ignored)"
103
105
  option :W, :nowait, "Ignore wait times"
104
106
  option :w, :wait, Float, "Wait time (in seconds) between client requests (ignored if testplan supplied)"
105
107
  option :p, :testplan, String, "Path to testplan"
106
- option :a, :arrival, Float, "Arrival rate (ignored)"
108
+ option :g, :granularity, Integer, "Amount of time (in seconds) between timeline rotations"
107
109
  command :verify => Stella::CLI
108
110
 
109
111
  about "Generate requests"
@@ -114,13 +116,15 @@ class Stella::CLI::Definition
114
116
  usage " $ stella generate -p path/2/testplan.rb -u 100 -r 50 http://stellaaahhhh.com:3114/"
115
117
  #usage " $ stella stress --clients=50 --repetitions=20 http://stellaaahhhh.com/"
116
118
  option :c, :clients, Integer, "Maximum number of virtual clients"
119
+ option :a, :arrival, Float, "Arrival rate (new clients per second)"
117
120
  option :r, :repetitions, Integer, "Number of times to repeat the testplan (per vclient)"
118
121
  option :d, :duration, String, "Max duration to run test"
119
122
  option :W, :nowait, "Ignore wait times"
120
123
  option :w, :wait, Float, "Wait time (in seconds) between client requests (ignored if testplan supplied)"
121
124
  option :p, :testplan, String, "Path to testplan"
122
- option :a, :arrival, Float, "Arrival rate (new clients per second)"
125
+ option :g, :granularity, Integer, "Amount of time (in seconds) between timeline rotations"
123
126
  command :generate => Stella::CLI
127
+
124
128
  about "Initialize Stella configuration"
125
129
  command :init do
126
130
  Stella::Config.init
data/lib/stella/cli.rb CHANGED
@@ -22,7 +22,7 @@ class Stella::CLI < Drydock::Command
22
22
  def run(mode)
23
23
  opts = { :mode => mode }
24
24
  opts[:hosts] = @hosts
25
- [:nowait, :clients, :repetitions, :duration, :arrival].each do |opt|
25
+ [:nowait, :clients, :repetitions, :duration, :arrival, :granularity].each do |opt|
26
26
  opts[opt] = @option.send(opt) unless @option.send(opt).nil?
27
27
  end
28
28
  [:'notemplates', :'nostats', :'noheader', :'noparam'].each do |opt|
@@ -46,7 +46,7 @@ module Stella::Data::HTTP
46
46
  def initialize (method=nil, uri_str=nil, version="1.1", &definition)
47
47
  @uri = uri_str.to_s
48
48
  @http_method, @http_version = method, version
49
- @headers, @params, @response_handler = {}, {}, {}
49
+ @header, @params, @response_handler = {}, {}, {}
50
50
  @resources = {}
51
51
  @autofollow = false
52
52
  @wait = 0
@@ -89,23 +89,26 @@ module Stella::Data::HTTP
89
89
  end
90
90
 
91
91
  def wait(*args)
92
+ args = [args].flatten.compact
92
93
  @wait = args.first unless args.empty?
93
94
  @wait
94
95
  end
95
96
  alias_method :sleep, :wait
96
97
 
97
98
  def headers(*args)
99
+ args = [args].flatten.compact
98
100
  unless args.empty?
99
101
  h = Hash === args[0] ? args[0] : {args[0]=> args[1]}
100
- @headers.merge! h unless h.empty?
102
+ @header.merge! h unless h.empty?
101
103
  end
102
- @headers
104
+ @header
103
105
  end
104
106
  alias_method :header, :headers
105
107
 
106
108
  # Set a resource key value pair in the get, post block.
107
109
  # These will be process later in Stella::Client
108
110
  def set(*args)
111
+ args = [args].flatten.compact
109
112
  unless args.empty?
110
113
  h = Hash === args[0] ? args[0] : {args[0]=> args[1]}
111
114
  @resources.merge! h unless h.empty?
@@ -115,6 +118,7 @@ module Stella::Data::HTTP
115
118
  alias_method :resources, :set
116
119
 
117
120
  def params(*args)
121
+ args = [args].flatten.compact
118
122
  unless args.empty?
119
123
  h = Hash === args[0] ? args[0] : {args[0]=> args[1]}
120
124
  @params.merge! h unless h.empty?
@@ -160,7 +164,7 @@ module Stella::Data::HTTP
160
164
  def freeze
161
165
  return if frozen?
162
166
  @params = convert_values_to_templates @params
163
- @headers = convert_values_to_templates @headers
167
+ @header = convert_values_to_templates @header
164
168
  super
165
169
  self
166
170
  end
@@ -50,7 +50,7 @@ module Stella::Engine
50
50
  log = Stella::Engine::Log.new Time.now.to_f, container.unique_id, client_id,
51
51
  'testplanid',
52
52
  usecase.id, req.id,
53
- req.http_method, container.status, uri,
53
+ req.http_method, container.status, uri.to_s,
54
54
  params, container.response.request.header.dump,
55
55
  container.response.header.dump,
56
56
  container.response.body.dump
@@ -89,7 +89,6 @@ module Stella::Engine
89
89
  testrun
90
90
  end
91
91
 
92
- ROTATE_TIMELINE = 5
93
92
  def execute_test_plan(packages, testrun)
94
93
  time_started = Time.now
95
94
 
@@ -133,7 +132,7 @@ module Stella::Engine
133
132
  Thread.current[:real_uctime].tick
134
133
  time_elapsed = (Time.now - time_started).to_i
135
134
 
136
- if (Time.now - prev_ptime).to_i >= ROTATE_TIMELINE
135
+ if (Time.now - prev_ptime).to_i >= testrun.granularity
137
136
  prev_ptime, ruct = Time.now, Thread.current[:real_uctime]
138
137
  if Stella.stdout.lev >= 2 && Thread.current == @threads.first
139
138
  args = [time_elapsed.to_i, ruct.n, ruct.mean, ruct.sd]
@@ -155,6 +154,8 @@ module Stella::Engine
155
154
 
156
155
  pqueue << package # return the package to the queue
157
156
  end
157
+
158
+ #p [testrun.arrival, 1/testrun.arrival]
158
159
 
159
160
  unless testrun.arrival.nil? || testrun.arrival.to_f <= 0
160
161
  # Create 1 second / users per second
@@ -163,6 +164,7 @@ module Stella::Engine
163
164
  Stella.stdout.info3 $/, "-> NEW CLIENT: %s of %s" % args
164
165
  sleep 1/testrun.arrival
165
166
  end
167
+
166
168
  }
167
169
 
168
170
  repscalc = Benelux::Stats::Calculator.new
@@ -170,6 +172,7 @@ module Stella::Engine
170
172
  @threads.each { |t| repscalc.sample(t[:real_reps]) }
171
173
  @real_reps = repscalc.mean.to_i
172
174
 
175
+
173
176
  #Stella.stdout.info "*** REPETITION #{@real_reps} of #{reps} ***"
174
177
 
175
178
  Stella.stdout.info2 $/, $/
@@ -187,7 +190,7 @@ module Stella::Engine
187
190
  end
188
191
 
189
192
  def prepare_dumper(testrun)
190
- hand = Stella::Hand.new(Load::ROTATE_TIMELINE, 2.seconds) do
193
+ hand = Stella::Hand.new(testrun.granularity, 2.seconds) do
191
194
  Benelux.update_global_timeline
192
195
  # @threads contains only stella clients
193
196
  concurrency = @threads.select { |t| !t.status.nil? }.size
@@ -202,6 +205,7 @@ module Stella::Engine
202
205
  Benelux.timeline.clear if testrun.nostats
203
206
  end
204
207
  hand.finally do
208
+ testrun.end_time = Time.now.utc.to_i
205
209
  testrun.save
206
210
  end
207
211
  hand
@@ -382,17 +386,19 @@ module Stella::Engine
382
386
  def update_prepare_request(client_id, usecase, req, counter)
383
387
 
384
388
  end
385
-
389
+
386
390
  def update_receive_response(client_id, usecase, uri, req, params, headers, counter, container)
387
391
  if @opts[:with_content]
388
392
  log = Stella::Engine::Log.new Time.now.to_f, container.unique_id, client_id,
389
393
  'testplanid',
390
394
  usecase.id, req.id,
391
- req.http_method, container.status, uri,
395
+ req.http_method, container.status, uri.to_s,
392
396
  params, container.response.request.header.dump,
393
397
  container.response.header.dump,
394
398
  container.response.body.dump
395
399
 
400
+ # Fix for no data, but why??
401
+ log.response_body = container.response.body.dump
396
402
  Benelux.thread_timeline.add_message log, :status => container.status, :kind => :log
397
403
  end
398
404
 
data/lib/stella/engine.rb CHANGED
@@ -84,17 +84,20 @@ end
84
84
 
85
85
  class Stella::Testrun < Storable
86
86
  CLIENT_LIMIT = 1000
87
+ GRANULARITY = 5
87
88
  include Gibbler::Complex
88
89
  field :id => String, &gibbler_id_processor
89
90
  field :status => String
90
91
  field :userid => String
91
92
  field :start_time => Integer
93
+ field :end_time => Integer
92
94
  field :clients => Integer
93
95
  field :duration => Integer
94
96
  field :arrival => Float
95
97
  field :repetitions => Integer
96
98
  field :wait => Float
97
99
  field :nowait => TrueClass
100
+ field :granularity => Integer
98
101
  field :withparam => TrueClass
99
102
  field :withheader => TrueClass
100
103
  field :notemplates => TrueClass
@@ -109,13 +112,32 @@ class Stella::Testrun < Storable
109
112
  gibbler :plan, :hosts, :mode, :clients, :duration, :repetitions, :wait, :start_time, :userid
110
113
  def initialize(plan=nil, opts={})
111
114
  @plan = plan
115
+ @granularity = GRANULARITY
112
116
  process_options! opts if !plan.nil? && !opts.empty?
113
117
  reset_stats
114
118
  end
115
119
  def id
116
- @id || self.digest
120
+ Gibbler::Digest.new(@id || self.digest)
121
+ end
122
+ def running?
123
+ (self.status.to_s == "running")
124
+ end
125
+ def done?
126
+ (self.status.to_s == "done")
127
+ end
128
+ def new?
129
+ (self.status.to_s == "new")
130
+ end
131
+ def pending?
132
+ (self.status.to_s == "pending")
117
133
  end
118
134
  def has_log?() !@log.nil? && !@log.empty? end
135
+ def elapsed_seconds
136
+ return 0 if @start_time.nil? || @start_time <= 0
137
+ return Time.now.utc.to_i - @start_time if @end_time.nil? || @end_time <= 0
138
+ @end_time - @start_time
139
+ end
140
+
119
141
  def self.from_hash(hash={})
120
142
  me = super(hash)
121
143
  me.plan = Stella::Testplan.from_hash(me.plan)
@@ -124,7 +146,7 @@ class Stella::Testrun < Storable
124
146
  me.samples.collect! do |sample|
125
147
  Stella::Testrun::Sample.from_hash(sample)
126
148
  end
127
-
149
+
128
150
  me.plan.usecases.uniq.each_with_index do |uc,i|
129
151
  uc.requests.each do |req|
130
152
  me.events.each_with_index do |event,idx| # do_request, etc...
data/stella.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{stella}
8
- s.version = "0.8.3.002"
8
+ s.version = "0.8.4.001"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Delano Mandelbaum"]
12
- s.date = %q{2010-03-15}
12
+ s.date = %q{2010-03-19}
13
13
  s.default_executable = %q{stella}
14
14
  s.description = %q{Blame Stella for breaking your web application!}
15
15
  s.email = %q{delano@solutious.com}
@@ -98,24 +98,24 @@ Gem::Specification.new do |s|
98
98
  s.specification_version = 3
99
99
 
100
100
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
101
- s.add_runtime_dependency(%q<gibbler>, [">= 0.7.4"])
101
+ s.add_runtime_dependency(%q<gibbler>, [">= 0.7.6"])
102
102
  s.add_runtime_dependency(%q<drydock>, [">= 0.6.9"])
103
- s.add_runtime_dependency(%q<benelux>, [">= 0.5.11"])
103
+ s.add_runtime_dependency(%q<benelux>, [">= 0.5.12"])
104
104
  s.add_runtime_dependency(%q<sysinfo>, [">= 0.7.3"])
105
105
  s.add_runtime_dependency(%q<storable>, [">= 0.6.4"])
106
106
  s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
107
107
  else
108
- s.add_dependency(%q<gibbler>, [">= 0.7.4"])
108
+ s.add_dependency(%q<gibbler>, [">= 0.7.6"])
109
109
  s.add_dependency(%q<drydock>, [">= 0.6.9"])
110
- s.add_dependency(%q<benelux>, [">= 0.5.11"])
110
+ s.add_dependency(%q<benelux>, [">= 0.5.12"])
111
111
  s.add_dependency(%q<sysinfo>, [">= 0.7.3"])
112
112
  s.add_dependency(%q<storable>, [">= 0.6.4"])
113
113
  s.add_dependency(%q<nokogiri>, [">= 0"])
114
114
  end
115
115
  else
116
- s.add_dependency(%q<gibbler>, [">= 0.7.4"])
116
+ s.add_dependency(%q<gibbler>, [">= 0.7.6"])
117
117
  s.add_dependency(%q<drydock>, [">= 0.6.9"])
118
- s.add_dependency(%q<benelux>, [">= 0.5.11"])
118
+ s.add_dependency(%q<benelux>, [">= 0.5.12"])
119
119
  s.add_dependency(%q<sysinfo>, [">= 0.7.3"])
120
120
  s.add_dependency(%q<storable>, [">= 0.6.4"])
121
121
  s.add_dependency(%q<nokogiri>, [">= 0"])
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.8.3.002
4
+ version: 0.8.4.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: 2010-03-15 00:00:00 -04:00
12
+ date: 2010-03-19 00:00:00 -04:00
13
13
  default_executable: stella
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.7.4
23
+ version: 0.7.6
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: drydock
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 0.5.11
43
+ version: 0.5.12
44
44
  version:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: sysinfo