solutious-stella 0.7.0.005 → 0.7.0.006
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/README.rdoc +1 -0
- data/examples/essentials/plan.rb +3 -3
- data/lib/stella.rb +6 -4
- data/lib/stella/client.rb +24 -18
- data/lib/stella/engine.rb +22 -44
- data/lib/stella/engine/functional.rb +46 -0
- data/lib/stella/engine/load.rb +23 -0
- data/lib/stella/testplan.rb +1 -1
- data/lib/stella/utils.rb +1 -1
- data/lib/stella/version.rb +1 -1
- data/stella.gemspec +3 -2
- data/vendor/httpclient-2.1.5.2/httpclient/session.rb +5 -3
- metadata +14 -4
data/README.rdoc
CHANGED
data/examples/essentials/plan.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
desc "Business Finder Testplan"
|
4
4
|
|
5
|
-
|
5
|
+
usecase 65, "Simple search" do
|
6
6
|
resource :search_terms, list('search_terms.csv')
|
7
7
|
|
8
8
|
get "/", "Homepage" do
|
@@ -35,7 +35,7 @@ xusecase 65, "Simple search" do
|
|
35
35
|
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
xusecase 10, "Self-serve" do
|
39
39
|
post "/listing/add", "Add a listing" do
|
40
40
|
wait 1..4
|
41
41
|
param :name => random(8)
|
@@ -47,7 +47,7 @@ usecase 10, "Self-serve" do
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
|
50
|
+
usecase "Listing API" do
|
51
51
|
|
52
52
|
get '/listings.yaml', "View All" do
|
53
53
|
response 200 do
|
data/lib/stella.rb
CHANGED
@@ -7,14 +7,15 @@ module Stella
|
|
7
7
|
|
8
8
|
LIB_HOME = File.expand_path File.dirname(__FILE__) unless defined?(LIB_HOME)
|
9
9
|
|
10
|
-
%w{storable sysinfo gibbler}.each do |dir|
|
10
|
+
%w{storable sysinfo gibbler benelux}.each do |dir|
|
11
11
|
$:.unshift File.join(LIB_HOME, '..', '..', dir, 'lib')
|
12
12
|
end
|
13
|
-
require 'storable'
|
14
13
|
require 'sysinfo'
|
14
|
+
require 'drydock/screen'
|
15
|
+
require 'storable'
|
15
16
|
require 'gibbler'
|
16
17
|
require 'gibbler/aliases'
|
17
|
-
require '
|
18
|
+
require 'benelux'
|
18
19
|
|
19
20
|
@@sysinfo = SysInfo.new.freeze
|
20
21
|
@@logger = Drydock::Screen
|
@@ -59,7 +60,8 @@ end
|
|
59
60
|
require 'stella/version'
|
60
61
|
require 'stella/exceptions'
|
61
62
|
require 'stella/utils'
|
63
|
+
require 'stella/config'
|
62
64
|
|
63
|
-
Stella::Utils.require_glob(Stella::LIB_HOME, 'stella', '*.rb')
|
64
65
|
Stella::Utils.require_vendor "httpclient", '2.1.5.2'
|
66
|
+
Stella::Utils.require_glob(Stella::LIB_HOME, 'stella', '*.rb')
|
65
67
|
|
data/lib/stella/client.rb
CHANGED
@@ -4,7 +4,9 @@ require 'nokogiri'
|
|
4
4
|
|
5
5
|
module Stella
|
6
6
|
class Client
|
7
|
+
include Gibbler::Complex
|
7
8
|
include Observable
|
9
|
+
|
8
10
|
attr_reader :client_id
|
9
11
|
attr_accessor :base_uri
|
10
12
|
attr_accessor :proxy
|
@@ -23,7 +25,6 @@ module Stella
|
|
23
25
|
usecase.requests.each do |req|
|
24
26
|
counter += 1
|
25
27
|
update(:prepare_request, usecase, req, counter)
|
26
|
-
|
27
28
|
uri_obj = URI.parse(req.uri)
|
28
29
|
params = prepare_params(usecase, req.params)
|
29
30
|
headers = prepare_headers(usecase, req.headers)
|
@@ -35,16 +36,17 @@ module Stella
|
|
35
36
|
|
36
37
|
meth = req.http_method.to_s.downcase
|
37
38
|
Stella.ld "#{req.http_method}: " << "#{uri_obj.to_s} " << params.inspect
|
38
|
-
|
39
|
+
|
39
40
|
begin
|
40
|
-
|
41
|
-
container.response = http_client.send(meth, uri, params, headers) # booya!
|
42
|
-
update(:receive_response, usecase, uri, req, params, container)
|
41
|
+
send_request http_client, usecase, meth, uri, req, params, headers, container
|
43
42
|
rescue => ex
|
44
43
|
update(:request_error, usecase, uri, req, params, ex)
|
45
44
|
next
|
46
45
|
end
|
47
46
|
|
47
|
+
#probe_header_size(container.response)
|
48
|
+
#probe_body_size(container.response)
|
49
|
+
|
48
50
|
ret = execute_response_handler container, req
|
49
51
|
|
50
52
|
Stella.lflush
|
@@ -70,6 +72,12 @@ module Stella
|
|
70
72
|
def benchmark?; @bm == true; end
|
71
73
|
|
72
74
|
private
|
75
|
+
def send_request(http_client, usecase, meth, uri, req, params, headers, container)
|
76
|
+
update(:send_request, usecase, uri, req, params, container)
|
77
|
+
container.response = http_client.send(meth, uri, params, headers) # booya!
|
78
|
+
update(:receive_response, usecase, uri, req, params, container)
|
79
|
+
end
|
80
|
+
|
73
81
|
def update(kind, *args)
|
74
82
|
changed and notify_observers(kind, @client_id, *args)
|
75
83
|
end
|
@@ -121,26 +129,24 @@ module Stella
|
|
121
129
|
#
|
122
130
|
# This method creates a new URI object using the @base_uri
|
123
131
|
# if necessary and replaces all variables with literal values.
|
124
|
-
# If no replacement value can be found, the variable
|
125
|
-
def build_request_uri(
|
126
|
-
uri =
|
127
|
-
|
128
|
-
if
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
end
|
132
|
+
# If no replacement value can be found, the variable will remain.
|
133
|
+
def build_request_uri(uri, params, container)
|
134
|
+
uri = URI::HTTP.build({:path => uri}) unless uri.is_a?(URI::Generic)
|
135
|
+
uri.scheme = base_uri.scheme if uri.scheme.nil?
|
136
|
+
uri.host = base_uri.host if uri.host.nil?
|
137
|
+
uri.port = base_uri.port if uri.port.nil?
|
138
|
+
uri.path ||= ''
|
139
|
+
uri.path.gsub! /\/$/, '' # Don't double up on the first slash
|
133
140
|
# We call req.uri again because we need
|
134
141
|
# to modify request_uri inside the loop.
|
135
|
-
|
142
|
+
uri.path.clone.scan(/:([a-z_]+)/i) do |instances|
|
136
143
|
instances.each do |varname|
|
137
144
|
val = find_replacement_value(varname, params, container)
|
138
145
|
#Stella.ld "FOUND: #{val}"
|
139
|
-
|
146
|
+
uri.path.gsub! /:#{varname}/, val.to_s unless val.nil?
|
140
147
|
end
|
141
148
|
end
|
142
|
-
uri
|
143
|
-
URI.parse uri
|
149
|
+
uri
|
144
150
|
end
|
145
151
|
|
146
152
|
# Testplan URIs can contain variables in the form <tt>:varname</tt>.
|
data/lib/stella/engine.rb
CHANGED
@@ -1,59 +1,37 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
module Stella::Engine
|
4
|
+
|
5
|
+
Benelux.add_timer Stella::Client, :execute
|
6
|
+
Benelux.add_timer Stella::Client, :send_request
|
7
|
+
Benelux.add_timer HTTPClient, :do_request
|
8
|
+
Benelux.add_timer HTTPClient::Session, :create_socket
|
9
|
+
Benelux.add_timer HTTPClient::Session, :connect
|
10
|
+
Benelux.add_timer HTTPClient::Session, :query
|
11
|
+
Benelux.add_timer HTTPClient::Session, :socket_gets_initial_line
|
12
|
+
Benelux.add_timer HTTPClient::Session, :get_body
|
13
|
+
|
4
14
|
module Base
|
5
15
|
extend self
|
6
|
-
def run
|
7
|
-
raise "override the run method"
|
8
|
-
end
|
9
16
|
|
10
17
|
def update(*args)
|
11
18
|
what, *args = args
|
12
|
-
|
13
|
-
|
14
|
-
Stella.
|
19
|
+
if respond_to?("update_#{what}")
|
20
|
+
Stella.ld "OBSERVER UPDATE: #{what}"
|
21
|
+
Stella.rescue { self.send("update_#{what}", *args) }
|
15
22
|
else
|
16
|
-
Stella.
|
17
|
-
self.send("update_#{what}", *args)
|
18
|
-
}
|
23
|
+
Stella.ld "NO UPDATE HANDLER FOR: #{what}"
|
19
24
|
end
|
20
25
|
end
|
21
|
-
|
22
|
-
def update_prepare_request(client_id, usecase, req, counter)
|
23
|
-
notice = "repeat: #{counter-1}" if counter > 1
|
24
|
-
Stella.li2 ' ' << " %-46s %16s ".att(:reverse) % [req.desc, notice]
|
25
|
-
end
|
26
|
-
|
27
|
-
def update_send_request(client_id, usecase, uri, req, params, counter)
|
28
26
|
|
29
|
-
end
|
30
|
-
|
31
|
-
def
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
Stella.li3 " %s: %s" % pair
|
38
|
-
end
|
39
|
-
Stella.li4 $/, " Content:"
|
40
|
-
Stella.li4 container.body.empty? ? ' [empty]' : container.body
|
41
|
-
Stella.li2 $/
|
42
|
-
end
|
43
|
-
|
44
|
-
def update_execute_response_handler(client_id, req, container)
|
45
|
-
end
|
46
|
-
|
47
|
-
def update_error_execute_response_handler(client_id, ex, req, container)
|
48
|
-
Stella.le ex.message
|
49
|
-
Stella.ld ex.backtrace
|
50
|
-
end
|
51
|
-
|
52
|
-
def update_request_error(client_id, usecase, uri, req, params, ex)
|
53
|
-
desc = "#{usecase.desc} > #{req.desc}"
|
54
|
-
Stella.le ' Client%-3s %-45s %s' % [client_id, desc, ex.message]
|
55
|
-
Stella.ld ex.backtrace
|
56
|
-
end
|
27
|
+
def run; raise; end
|
28
|
+
|
29
|
+
def update_prepare_request(*args) raise end
|
30
|
+
def update_send_request(*args) raise end
|
31
|
+
def update_receive_response(*args) raise end
|
32
|
+
def update_execute_response_handler(*args) raise end
|
33
|
+
def update_error_execute_response_handler(*args) raise end
|
34
|
+
def update_request_error(*args) raise end
|
57
35
|
|
58
36
|
end
|
59
37
|
end
|
@@ -16,6 +16,7 @@ module Stella::Engine
|
|
16
16
|
|
17
17
|
client = Stella::Client.new opts[:hosts].first
|
18
18
|
client.add_observer(self)
|
19
|
+
|
19
20
|
client.enable_benchmark_mode if opts[:benchmark]
|
20
21
|
|
21
22
|
Stella.li $/, "Starting test...", $/
|
@@ -28,9 +29,54 @@ module Stella::Engine
|
|
28
29
|
Stella.rescue { client.execute uc }
|
29
30
|
end
|
30
31
|
|
32
|
+
|
33
|
+
#p client.benelux_at(:execute_start).first.name
|
34
|
+
|
35
|
+
#p client.benelux_between(:execute_start, :execute_end)
|
36
|
+
|
37
|
+
#p client.benelux_duration(:execute)
|
38
|
+
|
31
39
|
!plan.errors?
|
32
40
|
end
|
33
41
|
|
42
|
+
|
43
|
+
def update_prepare_request(client_id, usecase, req, counter)
|
44
|
+
notice = "repeat: #{counter-1}" if counter > 1
|
45
|
+
Stella.li2 ' ' << " %-46s %16s ".att(:reverse) % [req.desc, notice]
|
46
|
+
end
|
47
|
+
|
48
|
+
def update_send_request(client_id, usecase, uri, req, params, counter)
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
def update_receive_response(client_id, usecase, uri, req, params, container)
|
53
|
+
Stella.li ' %-59s %3d' % [uri, container.status]
|
54
|
+
Stella.li2 " Method: " << req.http_method
|
55
|
+
Stella.li2 " Params: " << params.inspect
|
56
|
+
Stella.li3 $/, " Headers:"
|
57
|
+
container.headers.all.each do |pair|
|
58
|
+
Stella.li3 " %s: %s" % pair
|
59
|
+
end
|
60
|
+
Stella.li4 $/, " Content:"
|
61
|
+
Stella.li4 container.body.empty? ? ' [empty]' : container.body
|
62
|
+
Stella.li2 $/
|
63
|
+
end
|
64
|
+
|
65
|
+
def update_execute_response_handler(client_id, req, container)
|
66
|
+
end
|
67
|
+
|
68
|
+
def update_error_execute_response_handler(client_id, ex, req, container)
|
69
|
+
Stella.le ex.message
|
70
|
+
Stella.ld ex.backtrace
|
71
|
+
end
|
72
|
+
|
73
|
+
def update_request_error(client_id, usecase, uri, req, params, ex)
|
74
|
+
desc = "#{usecase.desc} > #{req.desc}"
|
75
|
+
Stella.le ' Client%-3s %-45s %s' % [client_id, desc, ex.message]
|
76
|
+
Stella.ld ex.backtrace
|
77
|
+
end
|
78
|
+
|
79
|
+
|
34
80
|
end
|
35
81
|
end
|
36
82
|
|
data/lib/stella/engine/load.rb
CHANGED
@@ -28,6 +28,7 @@ module Stella::Engine
|
|
28
28
|
Stella.lflush
|
29
29
|
sleep 0.3
|
30
30
|
|
31
|
+
|
31
32
|
Thread.ify packages, :threads => opts[:clients] do |package|
|
32
33
|
# TEMPFIX. The fill in build_thread_package is creating nil elements
|
33
34
|
next if package.nil?
|
@@ -36,8 +37,29 @@ module Stella::Engine
|
|
36
37
|
# so we clone it here so each thread is unique.
|
37
38
|
Stella.rescue { package.client.execute package.usecase }
|
38
39
|
end
|
40
|
+
|
41
|
+
#package.client.benelux_timeline.each do |i|
|
42
|
+
# Stella.li "#{package.client.client_id}: #{i.to_f}: #{i.name}"
|
43
|
+
#end
|
44
|
+
#t = Benelux.thread_timeline.sort
|
45
|
+
#dur = t.last.to_f - t.first.to_f
|
46
|
+
#Stella.li [:thread, t.first.name, t.last.name, dur].inspect
|
47
|
+
#Stella.lflush
|
39
48
|
end
|
40
49
|
|
50
|
+
#t = Benelux.timeline.sort
|
51
|
+
#dur = t.last.to_f - t.first.to_f
|
52
|
+
#Stella.li [:global, t.first.name, t.last.name, dur].inspect
|
53
|
+
|
54
|
+
#puts Thread.list
|
55
|
+
#p Benelux.timeline
|
56
|
+
|
57
|
+
prev = nil
|
58
|
+
#Stella.li Benelux.timeline.sort.collect { |obj|
|
59
|
+
# str = "#{obj.to_f}: #{obj.name} (#{obj.same_timeline?(prev)})"
|
60
|
+
# prev = obj
|
61
|
+
# str
|
62
|
+
#}
|
41
63
|
!plan.errors?
|
42
64
|
end
|
43
65
|
|
@@ -81,6 +103,7 @@ module Stella::Engine
|
|
81
103
|
packages
|
82
104
|
end
|
83
105
|
|
106
|
+
|
84
107
|
def update_prepare_request(client_id, usecase, req, counter)
|
85
108
|
|
86
109
|
end
|
data/lib/stella/testplan.rb
CHANGED
@@ -88,7 +88,7 @@ class Testplan
|
|
88
88
|
|
89
89
|
def pretty
|
90
90
|
str = []
|
91
|
-
str << " %-
|
91
|
+
str << " %-66s ".att(:reverse) % [@desc]
|
92
92
|
@usecases.each_with_index do |uc,i|
|
93
93
|
description = uc.desc || "Usecase ##{i+1}"
|
94
94
|
str << " %s (%s%%)".bright % [description, uc.ratio_pretty]
|
data/lib/stella/utils.rb
CHANGED
@@ -66,7 +66,7 @@ module Stella
|
|
66
66
|
# vendor/httpclient-2.1.5.2/httpclient
|
67
67
|
#
|
68
68
|
def require_vendor(name, version)
|
69
|
-
|
69
|
+
$:.unshift File.join(LIB_HOME, '..', 'vendor', "#{name}-#{version}")
|
70
70
|
require name
|
71
71
|
end
|
72
72
|
|
data/lib/stella/version.rb
CHANGED
data/stella.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
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.
|
5
|
-
s.summary = "Stella:
|
4
|
+
s.version = "0.7.0.006"
|
5
|
+
s.summary = "Stella: Perform load tests on your web applications with beauty and brute strength."
|
6
6
|
s.description = s.summary
|
7
7
|
s.author = "Delano Mandelbaum"
|
8
8
|
s.email = "delano@solutious.com"
|
@@ -15,6 +15,7 @@
|
|
15
15
|
|
16
16
|
s.executables = %w[stella]
|
17
17
|
|
18
|
+
s.add_dependency 'benelux'
|
18
19
|
s.add_dependency 'drydock', '>= 0.6.8'
|
19
20
|
s.add_dependency 'gibbler', '>= 0.6.2'
|
20
21
|
s.add_dependency 'storable', '>= 0.5.7'
|
@@ -666,7 +666,6 @@ class HTTPClient
|
|
666
666
|
end
|
667
667
|
|
668
668
|
def create_socket(site)
|
669
|
-
@timer.create_socket
|
670
669
|
socket = nil
|
671
670
|
begin
|
672
671
|
@debug_dev << "! CONNECT TO #{site.host}:#{site.port}\n" if @debug_dev
|
@@ -741,12 +740,15 @@ class HTTPClient
|
|
741
740
|
end
|
742
741
|
@next_connection = false unless @content_length
|
743
742
|
end
|
744
|
-
|
743
|
+
|
744
|
+
# Added by delano for Benelux support
|
745
|
+
def socket_gets_initial_line(*args); @socket.gets(*args); end
|
746
|
+
|
745
747
|
StatusParseRegexp = %r(\AHTTP/(\d+\.\d+)\s+(\d\d\d)\s*([^\r\n]+)?\r?\n\z)
|
746
748
|
def parse_header
|
747
749
|
timeout(@receive_timeout, ReceiveTimeoutError) do
|
748
750
|
begin
|
749
|
-
initial_line =
|
751
|
+
initial_line = socket_gets_initial_line("\n")
|
750
752
|
if initial_line.nil?
|
751
753
|
raise KeepAliveDisconnected.new
|
752
754
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solutious-stella
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.0.
|
4
|
+
version: 0.7.0.006
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Delano Mandelbaum
|
@@ -12,6 +12,16 @@ cert_chain: []
|
|
12
12
|
date: 2009-05-16 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: benelux
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
15
25
|
- !ruby/object:Gem::Dependency
|
16
26
|
name: drydock
|
17
27
|
type: :runtime
|
@@ -62,7 +72,7 @@ dependencies:
|
|
62
72
|
- !ruby/object:Gem::Version
|
63
73
|
version: "0"
|
64
74
|
version:
|
65
|
-
description: "Stella:
|
75
|
+
description: "Stella: Perform load tests on your web applications with beauty and brute strength."
|
66
76
|
email: delano@solutious.com
|
67
77
|
executables:
|
68
78
|
- stella
|
@@ -128,7 +138,7 @@ post_install_message:
|
|
128
138
|
rdoc_options:
|
129
139
|
- --line-numbers
|
130
140
|
- --title
|
131
|
-
- "Stella:
|
141
|
+
- "Stella: Perform load tests on your web applications with beauty and brute strength."
|
132
142
|
- --main
|
133
143
|
- README.rdoc
|
134
144
|
require_paths:
|
@@ -151,6 +161,6 @@ rubyforge_project: stella
|
|
151
161
|
rubygems_version: 1.3.5
|
152
162
|
signing_key:
|
153
163
|
specification_version: 2
|
154
|
-
summary: "Stella:
|
164
|
+
summary: "Stella: Perform load tests on your web applications with beauty and brute strength."
|
155
165
|
test_files: []
|
156
166
|
|