stella 0.7.0.002 → 0.7.0.003

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -34,6 +34,7 @@ This is an early preview of Stella. It's still missing the following features (a
34
34
 
35
35
  == Test Plan Example
36
36
 
37
+
37
38
  Test plans are defined in the Ruby programming language. This makes it possible to define sophisticated logic to handle responses. They also typically contain more than one usecase which is important when simulating realistic load. In this example, 65% of virtual users will execute the first usecase and 35% will execute the second.
38
39
 
39
40
  usecase 65, "Simple search" do
data/bin/stella CHANGED
@@ -12,9 +12,11 @@
12
12
  # Usage:
13
13
  #
14
14
  # $ stella -h
15
- # $ stella verify
15
+ # $ stella verify -p plans/basic.rb http://test.example.com/
16
16
  # $ stella load -u 10 -t 60 http://test.example.com/
17
17
  # $ stella load -u 10 -r 40 -p plans/basic.rb http://test.example.com/
18
+ #
19
+ #--
18
20
 
19
21
  STELLA_LIB_HOME = File.expand_path File.join(File.dirname(__FILE__), '..', 'lib')
20
22
 
@@ -1,4 +1,4 @@
1
- # 1f5e852e934debd56aa98552c0a9227c93006f21
1
+ # 4f61ac3d5607139350b50335ca59a34d04b34ec7
2
2
 
3
3
  desc "Business Finder Testplan"
4
4
 
@@ -58,7 +58,7 @@ usecase "YAML API" do
58
58
 
59
59
  end
60
60
 
61
- usecase 10, "Advertiser self-serve" do
61
+ usecase 10, "Self-serve" do
62
62
  post "/listing/add" do
63
63
  desc "Add a business"
64
64
  wait 1..4
data/lib/stella.rb CHANGED
@@ -16,7 +16,6 @@ require 'threadify'
16
16
  require 'drydock/screen'
17
17
 
18
18
  module Stella
19
- VERSION = "0.7.0.002"
20
19
  extend self
21
20
  require 'stella/version'
22
21
  require 'stella/exceptions'
data/lib/stella/client.rb CHANGED
@@ -16,6 +16,7 @@ module Stella
16
16
  @stats = Stella::Stats.new("Client #{@client_id}")
17
17
  end
18
18
 
19
+
19
20
  def execute(usecase)
20
21
  http_client = generate_http_client
21
22
  container = Container.new(usecase)
@@ -30,16 +31,15 @@ module Stella
30
31
  meth = req.http_method.to_s.downcase
31
32
  Stella.ld "#{meth}: " << "#{uri_obj.to_s} " << req.params.inspect
32
33
 
33
- changed and notify_observers(:send_request, @client_id, usecase, meth, uri, req, params, counter)
34
34
  begin
35
+ update(:send_request, usecase, meth, uri, req, params, counter)
35
36
  container.response = http_client.send(meth, uri, params) # booya!
36
- changed and notify_observers(:receive_response, @client_id, usecase, meth, uri, req, params, container)
37
+ update(:receive_response, usecase, meth, uri, req, params, container)
37
38
  rescue => ex
38
- changed and notify_observers(:request_error, @client_id, usecase, meth, uri, req, params, ex)
39
+ update(:request_error, usecase, meth, uri, req, params, ex)
39
40
  next
40
41
  end
41
42
 
42
-
43
43
  ret = execute_response_handler container, req
44
44
 
45
45
  Drydock::Screen.flush
@@ -62,6 +62,11 @@ module Stella
62
62
  def benchmark?; @bm == true; end
63
63
 
64
64
  private
65
+ def update(kind, *args)
66
+ changed
67
+ notify_observers(kind, @client_id, *args)
68
+ end
69
+
65
70
  def run_sleeper(wait)
66
71
  if wait.is_a?(Range)
67
72
  ms = rand(wait.last * 1000).to_f
@@ -139,19 +144,19 @@ module Stella
139
144
  # HTTP response status against the configured handlers.
140
145
  # If several match, the first one is used.
141
146
  def execute_response_handler(container, req)
142
- handlers = req.response.select do |regex,handler|
147
+ handler = nil
148
+ req.response.each_pair do |regex,h|
143
149
  regex = /#{regex}/ unless regex.is_a? Regexp
144
150
  Stella.ld "HANDLER REGEX: #{regex} (#{container.status})"
145
- container.status.to_s =~ regex
151
+ handler = h and break if container.status.to_s =~ regex
146
152
  end
147
153
  ret = nil
148
- unless handlers.empty?
154
+ unless handler.nil?
149
155
  begin
150
- changed
151
- ret = container.instance_eval &handlers.values.first
152
- notify_observers(:execute_response_handler, @client_id, req, container)
156
+ ret = container.instance_eval &handler
157
+ update(:execute_response_handler, req, container)
153
158
  rescue => ex
154
- notify_observers(:error_execute_response_handler, @client_id, ex, req, container)
159
+ update(:error_execute_response_handler, ex, req, container)
155
160
  Stella.ld ex.message, ex.backtrace
156
161
  end
157
162
  end
@@ -1,12 +1,12 @@
1
1
 
2
2
 
3
3
  module Stella
4
- module Version
4
+ module VERSION
5
5
  unless defined?(MAJOR)
6
6
  MAJOR = 0.freeze
7
7
  MINOR = 7.freeze
8
8
  TINY = 0.freeze
9
- PATCH = '001'.freeze
9
+ PATCH = '003'.freeze
10
10
  end
11
11
  def self.to_s; [MAJOR, MINOR, TINY].join('.'); end
12
12
  def self.to_f; self.to_s.to_f; end
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.0.002"
4
+ s.version = "0.7.0.003"
5
5
  s.summary = "Stella: Your friend in performance testing."
6
6
  s.description = s.summary
7
7
  s.author = "Delano Mandelbaum"
@@ -15,10 +15,11 @@
15
15
 
16
16
  s.executables = %w[stella]
17
17
 
18
- s.add_dependency 'drydock', '>= 0.6.7'
18
+ s.add_dependency 'drydock', '>= 0.6.8'
19
19
  s.add_dependency 'gibbler', '>= 0.6.2'
20
20
  s.add_dependency 'storable', '>= 0.5.7'
21
21
  s.add_dependency 'httpclient', '>= 2.1.5'
22
+ s.add_dependency 'nokogiri'
22
23
 
23
24
  # = MANIFEST =
24
25
  # git ls-files
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.0.002
4
+ version: 0.7.0.003
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-09-15 00:00:00 -04:00
12
+ date: 2009-09-16 00:00:00 -04: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.6.7
23
+ version: 0.6.8
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: gibbler
@@ -52,6 +52,16 @@ dependencies:
52
52
  - !ruby/object:Gem::Version
53
53
  version: 2.1.5
54
54
  version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: nokogiri
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
55
65
  description: "Stella: Your friend in performance testing."
56
66
  email: delano@solutious.com
57
67
  executables: