stella 0.7.3.002 → 0.7.4.001
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +9 -0
- data/bin/stella +26 -12
- data/examples/cookies/plan.rb +0 -1
- data/examples/essentials/plan.rb +1 -1
- data/lib/stella.rb +58 -42
- data/lib/stella/cli.rb +12 -4
- data/lib/stella/client.rb +43 -18
- data/lib/stella/client/container.rb +4 -1
- data/lib/stella/common.rb +255 -0
- data/lib/stella/data.rb +6 -4
- data/lib/stella/data/http.rb +126 -2
- data/lib/stella/engine.rb +25 -8
- data/lib/stella/engine/functional.rb +37 -30
- data/lib/stella/engine/load_create.rb +12 -10
- data/lib/stella/engine/load_package.rb +3 -4
- data/lib/stella/engine/load_queue.rb +9 -28
- data/lib/stella/engine/loadbase.rb +218 -82
- data/lib/stella/logger.rb +143 -0
- data/lib/stella/testplan.rb +174 -18
- data/stella.gemspec +5 -18
- metadata +6 -19
- data/lib/stella/client/modifiers.rb +0 -20
- data/lib/stella/config.rb +0 -87
- data/lib/stella/data/http/body.rb +0 -15
- data/lib/stella/data/http/request.rb +0 -129
- data/lib/stella/data/http/response.rb +0 -92
- data/lib/stella/exceptions.rb +0 -20
- data/lib/stella/mixins.rb +0 -5
- data/lib/stella/mixins/numeric.rb +0 -24
- data/lib/stella/mixins/string.rb +0 -16
- data/lib/stella/mixins/thread.rb +0 -6
- data/lib/stella/mixins/time.rb +0 -75
- data/lib/stella/stats.rb +0 -79
- data/lib/stella/testplan/stats.rb +0 -26
- data/lib/stella/testplan/usecase.rb +0 -119
- data/lib/stella/version.rb +0 -15
data/lib/stella/stats.rb
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
|
2
|
-
module Stella
|
3
|
-
# Based on Mongrel::Stats, Copyright (c) 2005 Zed A. Shaw
|
4
|
-
class Stats < Array
|
5
|
-
|
6
|
-
attr_reader :sum, :sumsq, :n, :min, :max
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
reset
|
10
|
-
end
|
11
|
-
|
12
|
-
def +(obj)
|
13
|
-
puts obj.class
|
14
|
-
end
|
15
|
-
|
16
|
-
# Resets the internal counters so you can start sampling again.
|
17
|
-
def reset
|
18
|
-
self.clear
|
19
|
-
@n, @sum, @sumsq = 0.0, 0.0, 0.0
|
20
|
-
@last_time = 0.0
|
21
|
-
@min, @max = 0.0, 0.0
|
22
|
-
end
|
23
|
-
|
24
|
-
# Adds a sampling to the calculations.
|
25
|
-
def sample(s)
|
26
|
-
self << s
|
27
|
-
update s
|
28
|
-
end
|
29
|
-
|
30
|
-
def update(s)
|
31
|
-
@sum += s
|
32
|
-
@sumsq += s * s
|
33
|
-
if @n == 0
|
34
|
-
@min = @max = s
|
35
|
-
else
|
36
|
-
@min = s if @min > s
|
37
|
-
@max = s if @max < s
|
38
|
-
end
|
39
|
-
@n+=1
|
40
|
-
end
|
41
|
-
|
42
|
-
# Dump this Stats object with an optional additional message.
|
43
|
-
def dump(msg = "", out=STDERR)
|
44
|
-
out.puts "#{msg}: #{self.inspect}"
|
45
|
-
end
|
46
|
-
|
47
|
-
# Returns a common display (used by dump)
|
48
|
-
def inspect
|
49
|
-
v = [mean, @n, @sum, @sumsq, sd, @min, @max]
|
50
|
-
t = %q"N=%0.4f SUM=%0.4f SUMSQ=%0.4f SD=%0.4f MIN=%0.4f MAX=%0.4f"
|
51
|
-
("%0.4f: " << t) % v
|
52
|
-
end
|
53
|
-
|
54
|
-
def to_s; mean.to_s; end
|
55
|
-
def to_f; mean.to_f; end
|
56
|
-
def to_i; mean.to_i; end
|
57
|
-
|
58
|
-
# Calculates and returns the mean for the data passed so far.
|
59
|
-
def mean; return 0.0 unless @n > 0; @sum / @n; end
|
60
|
-
|
61
|
-
# Calculates the standard deviation of the data so far.
|
62
|
-
def sd
|
63
|
-
return 0.0 if @n <= 1
|
64
|
-
# (sqrt( ((s).sumsq - ( (s).sum * (s).sum / (s).n)) / ((s).n-1) ))
|
65
|
-
begin
|
66
|
-
return Math.sqrt( (@sumsq - ( @sum * @sum / @n)) / (@n-1) )
|
67
|
-
rescue Errno::EDOM
|
68
|
-
return 0.0
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def recalculate
|
73
|
-
samples = self.clone
|
74
|
-
reset
|
75
|
-
samples.each { |s| sample(s) }
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
79
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
|
2
|
-
module Stella
|
3
|
-
class Testplan
|
4
|
-
|
5
|
-
class Stats
|
6
|
-
include Gibbler::Complex
|
7
|
-
attr_reader :requests
|
8
|
-
|
9
|
-
def initialize
|
10
|
-
@requests = OpenStruct.new
|
11
|
-
reset
|
12
|
-
end
|
13
|
-
|
14
|
-
def total_requests
|
15
|
-
@requests.successful + @requests.failed
|
16
|
-
end
|
17
|
-
|
18
|
-
def reset
|
19
|
-
@requests.successful = 0
|
20
|
-
@requests.failed = 0
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
@@ -1,119 +0,0 @@
|
|
1
|
-
autoload :CSV, 'csv'
|
2
|
-
|
3
|
-
module Stella
|
4
|
-
class Testplan
|
5
|
-
|
6
|
-
#
|
7
|
-
# Any valid Ruby syntax will do the trick:
|
8
|
-
#
|
9
|
-
# usecase(10, "Self-serve") {
|
10
|
-
# post("/listing/add", "Add a listing") {
|
11
|
-
# wait 1..4
|
12
|
-
# param :name => random(8)
|
13
|
-
# param :city => "Vancouver"
|
14
|
-
# response(302) {
|
15
|
-
# repeat 3
|
16
|
-
# }
|
17
|
-
# }
|
18
|
-
# }
|
19
|
-
#
|
20
|
-
class Usecase
|
21
|
-
include Gibbler::Complex
|
22
|
-
include Stella::Data::Helpers
|
23
|
-
extend Attic
|
24
|
-
|
25
|
-
class Auth < Struct.new(:kind, :user, :pass)
|
26
|
-
include Gibbler::Complex
|
27
|
-
end
|
28
|
-
|
29
|
-
attic :base_path # we don't want gibbler to see this
|
30
|
-
attic :plan_path
|
31
|
-
|
32
|
-
attr_accessor :desc
|
33
|
-
attr_writer :ratio
|
34
|
-
attr_reader :http_auth
|
35
|
-
|
36
|
-
attr_accessor :requests
|
37
|
-
attr_accessor :resources
|
38
|
-
|
39
|
-
class UnknownResource < Stella::Error
|
40
|
-
def message; "UnknownResource: #{@obj}"; end
|
41
|
-
end
|
42
|
-
|
43
|
-
def initialize(&blk)
|
44
|
-
@requests, @resources = [], {}
|
45
|
-
instance_eval &blk unless blk.nil?
|
46
|
-
end
|
47
|
-
|
48
|
-
def desc(*args)
|
49
|
-
@desc = args.first unless args.empty?
|
50
|
-
@desc
|
51
|
-
end
|
52
|
-
|
53
|
-
def resource(name, value=nil)
|
54
|
-
@resources[name] = value unless value.nil?
|
55
|
-
@resources[name]
|
56
|
-
end
|
57
|
-
|
58
|
-
def ratio
|
59
|
-
r = (@ratio || 0).to_f
|
60
|
-
r = r/100 if r > 1
|
61
|
-
r
|
62
|
-
end
|
63
|
-
|
64
|
-
def ratio_pretty
|
65
|
-
r = (@ratio || 0).to_f
|
66
|
-
r > 1.0 ? r.to_i : (r * 100).to_i
|
67
|
-
end
|
68
|
-
|
69
|
-
# Reads the contents of the file <tt>path</tt> (the current working
|
70
|
-
# directory is assumed to be the same directory containing the test plan).
|
71
|
-
def read(path)
|
72
|
-
path = File.join(base_path, path) if base_path
|
73
|
-
Stella.ld "READING FILE: #{path}"
|
74
|
-
File.read(path)
|
75
|
-
end
|
76
|
-
|
77
|
-
def list(path)
|
78
|
-
read(path).split $/
|
79
|
-
end
|
80
|
-
|
81
|
-
def csv(path)
|
82
|
-
path = File.join(base_path, path) if base_path
|
83
|
-
Stella.ld "READING CSV: #{path}"
|
84
|
-
CSV.read(path)
|
85
|
-
end
|
86
|
-
|
87
|
-
def freeze
|
88
|
-
@requests.each { |r| r.freeze }
|
89
|
-
super
|
90
|
-
self
|
91
|
-
end
|
92
|
-
|
93
|
-
def auth(user, pass=nil, kind=:basic)
|
94
|
-
@http_auth ||= Auth.new
|
95
|
-
@http_auth.user, @http_auth.pass, @http_auth.kind = user, pass, kind
|
96
|
-
end
|
97
|
-
|
98
|
-
def add_request(meth, *args, &blk)
|
99
|
-
req = Stella::Data::HTTP::Request.new meth.to_s.upcase, args[0], &blk
|
100
|
-
req.desc = args[1] if args.size > 1 # Description is optional
|
101
|
-
Stella.ld req
|
102
|
-
@requests << req
|
103
|
-
req
|
104
|
-
end
|
105
|
-
def get(*args, &blk); add_request :get, *args, &blk; end
|
106
|
-
def put(*args, &blk); add_request :put, *args, &blk; end
|
107
|
-
def post(*args, &blk); add_request :post, *args, &blk; end
|
108
|
-
def head(*args, &blk); add_request :head, *args, &blk; end
|
109
|
-
def delete(*args, &blk); add_request :delete, *args, &blk; end
|
110
|
-
|
111
|
-
def xget(*args, &blk); Stella.ld "Skipping get" end
|
112
|
-
def xput(*args, &blk); Stella.ld "Skipping put" end
|
113
|
-
def xpost(*args, &blk); Stella.ld "Skipping post" end
|
114
|
-
def xhead(*args, &blk); Stella.ld "Skipping head" end
|
115
|
-
def xdelete(*args, &blk); Stella.ld "Skipping delete" end
|
116
|
-
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
data/lib/stella/version.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
module Stella
|
4
|
-
module VERSION
|
5
|
-
unless defined?(MAJOR)
|
6
|
-
MAJOR = 0.freeze
|
7
|
-
MINOR = 7.freeze
|
8
|
-
TINY = 3.freeze
|
9
|
-
PATCH = '002'.freeze
|
10
|
-
end
|
11
|
-
def self.to_s; [MAJOR, MINOR, TINY].join('.'); end
|
12
|
-
def self.to_f; self.to_s.to_f; end
|
13
|
-
def self.patch; PATCH; end
|
14
|
-
end
|
15
|
-
end
|