stella 2.0.1.002 → 2.0.3.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 +9 -1
- data/Gemfile +3 -1
- data/Gemfile.lock +4 -0
- data/VERSION.yml +2 -2
- data/bin/stella +1 -0
- data/lib/stella/api.rb +65 -0
- data/lib/stella/cli.rb +37 -28
- data/lib/stella/report.rb +2 -1
- data/lib/stella/testplan.rb +25 -6
- data/stella.gemspec +3 -2
- metadata +3 -2
data/CHANGES.txt
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
STELLA, CHANGES
|
2
2
|
|
3
|
-
#### 2.0.
|
3
|
+
#### 2.0.3 (2011-07-06) ###############################
|
4
4
|
|
5
|
+
* ADDED: Stella::API
|
6
|
+
* ADDED: --remote global for running checkups via www.blamestella.com (beta)
|
7
|
+
|
8
|
+
|
9
|
+
#### 2.0.2 (2011-06-09) ###############################
|
10
|
+
|
11
|
+
* FIXED: Gibbler ID fixes
|
5
12
|
* ADDED: --wait option for checkup command
|
13
|
+
* CHANGE: Don't freeze testplan
|
6
14
|
|
7
15
|
|
8
16
|
#### 2.0.1 (2011-06-08) ###############################
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -17,6 +17,7 @@ GEM
|
|
17
17
|
storable (>= 0.8.6)
|
18
18
|
builder (3.0.0)
|
19
19
|
caesars (0.7.4)
|
20
|
+
crack (0.1.8)
|
20
21
|
drydock (0.6.9)
|
21
22
|
familia (0.7.1)
|
22
23
|
gibbler (>= 0.8.6)
|
@@ -27,6 +28,8 @@ GEM
|
|
27
28
|
gibbler (0.8.9)
|
28
29
|
attic (>= 0.4.0)
|
29
30
|
highline (1.6.1)
|
31
|
+
httparty (0.7.3)
|
32
|
+
crack (= 0.1.8)
|
30
33
|
ipaddress (0.7.0)
|
31
34
|
mime-types (1.16)
|
32
35
|
multi_json (0.0.5)
|
@@ -73,6 +76,7 @@ DEPENDENCIES
|
|
73
76
|
drydock (= 0.6.9)
|
74
77
|
familia (= 0.7.1)
|
75
78
|
gibbler (= 0.8.9)
|
79
|
+
httparty (= 0.7.3)
|
76
80
|
ipaddress (= 0.7.0)
|
77
81
|
multi_json
|
78
82
|
nokogiri (= 1.4.4)
|
data/VERSION.yml
CHANGED
data/bin/stella
CHANGED
@@ -45,6 +45,7 @@ class Stella::CLI::Definition
|
|
45
45
|
#global :P, :withparam, "Include __stella query parameter header"
|
46
46
|
global :T, :timeout, Float, "HTTP request timeout (default: unlimited)"
|
47
47
|
global :F, :format, String, "Output format (partial support)"
|
48
|
+
global :R, :remote, "Run command remotely (via blamestella.com)"
|
48
49
|
global :f, :filter, String, "Only run usecases that match this filter"
|
49
50
|
global :p, :testplan, String, "Path to testplan"
|
50
51
|
global :n, :nocolor, "Disable output colors" do
|
data/lib/stella/api.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'stella'
|
3
|
+
|
4
|
+
class Stella
|
5
|
+
class API
|
6
|
+
include HTTParty
|
7
|
+
|
8
|
+
ssl_ca_file Stella::Client::SSL_CERT_PATH
|
9
|
+
format :json
|
10
|
+
attr_reader :httparty_opts, :response
|
11
|
+
def initialize user=nil, key=nil, httparty_opts={}
|
12
|
+
self.class.base_uri ENV['STELLA_HOST'] || 'https://www.blamestella.com/api/v2'
|
13
|
+
@httparty_opts = httparty_opts.merge({
|
14
|
+
:basic_auth => { :username => user || ENV['STELLA_USER'], :password => key || ENV['STELLA_KEY'] }
|
15
|
+
})
|
16
|
+
end
|
17
|
+
def get path, params=nil
|
18
|
+
opts = httparty_opts
|
19
|
+
opts[:query] = params || {}
|
20
|
+
execute_request :get, path, opts
|
21
|
+
end
|
22
|
+
def post path, params=nil
|
23
|
+
opts = httparty_opts
|
24
|
+
opts[:body] = params || {}
|
25
|
+
execute_request :post, path, opts
|
26
|
+
end
|
27
|
+
private
|
28
|
+
def uri_path *args
|
29
|
+
args.unshift '' # force leading slash
|
30
|
+
path = args.flatten.join('/')
|
31
|
+
path.gsub '//', '/'
|
32
|
+
end
|
33
|
+
def execute_request meth, path, opts
|
34
|
+
path = uri_path [path]
|
35
|
+
@response = self.class.send meth, path, opts
|
36
|
+
indifferent_params @response.parsed_response
|
37
|
+
end
|
38
|
+
# Enable string or symbol key access to the nested params hash.
|
39
|
+
def indifferent_params(params)
|
40
|
+
if params.is_a?(Hash)
|
41
|
+
params = indifferent_hash.merge(params)
|
42
|
+
params.each do |key, value|
|
43
|
+
next unless value.is_a?(Hash) || value.is_a?(Array)
|
44
|
+
params[key] = indifferent_params(value)
|
45
|
+
end
|
46
|
+
elsif params.is_a?(Array)
|
47
|
+
params.collect! do |value|
|
48
|
+
if value.is_a?(Hash) || value.is_a?(Array)
|
49
|
+
indifferent_params(value)
|
50
|
+
else
|
51
|
+
value
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
# Creates a Hash with indifferent access.
|
57
|
+
def indifferent_hash
|
58
|
+
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
#Stella::API.debug_output $stdout
|
64
|
+
#Stella::API.base_uri 'http://localhost:3000/api/v2'
|
65
|
+
#@api = Stella::API.new
|
data/lib/stella/cli.rb
CHANGED
@@ -19,43 +19,52 @@ class Stella::CLI < Drydock::Command
|
|
19
19
|
:concurrency => @option.concurrency || 1,
|
20
20
|
:wait => @option.wait || 1
|
21
21
|
}
|
22
|
-
if @global.
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
@plan = Stella::Testplan.plan(planname)
|
31
|
-
if filter
|
32
|
-
@plan.usecases.reject! { |uc|
|
33
|
-
ret = !uc.desc.to_s.downcase.match(filter.downcase)
|
34
|
-
Stella.ld " rejecting #{uc.desc}" if ret
|
35
|
-
ret
|
36
|
-
}
|
37
|
-
end
|
38
|
-
Stella.ld "Running #{@plan.usecases.size} usecases"
|
22
|
+
if @global.remote
|
23
|
+
require 'stella/api'
|
24
|
+
@api = Stella::API.new
|
25
|
+
ret = @api.post :checkup, :uri => base_uri
|
26
|
+
begin
|
27
|
+
run_hash = @api.get "/checkup/#{ret[:runid]}"
|
28
|
+
@run = Stella::Testrun.from_hash run_hash if run_hash
|
29
|
+
end while @run && !@run.done?
|
39
30
|
else
|
40
|
-
@
|
31
|
+
if @global.testplan
|
32
|
+
unless File.owned?(@global.testplan)
|
33
|
+
raise ArgumentError, "File not found #{@global.testplan}"
|
34
|
+
end
|
35
|
+
Stella.ld "Load #{@global.testplan}"
|
36
|
+
load @global.testplan
|
37
|
+
filter = @global.filter
|
38
|
+
planname = Stella::Testplan.plans.keys.first
|
39
|
+
@plan = Stella::Testplan.plan(planname)
|
40
|
+
if filter
|
41
|
+
@plan.usecases.reject! { |uc|
|
42
|
+
ret = !uc.desc.to_s.downcase.match(filter.downcase)
|
43
|
+
Stella.ld " rejecting #{uc.desc}" if ret
|
44
|
+
ret
|
45
|
+
}
|
46
|
+
end
|
47
|
+
Stella.ld "Running #{@plan.usecases.size} usecases"
|
48
|
+
else
|
49
|
+
@plan = Stella::Testplan.new base_uri
|
50
|
+
end
|
51
|
+
@run = @plan.checkup base_uri, run_opts
|
41
52
|
end
|
42
|
-
|
53
|
+
|
43
54
|
@report = @run.report
|
55
|
+
|
44
56
|
if Stella.quiet?
|
45
|
-
@exit_code = report.error_count
|
57
|
+
@exit_code = @report.error_count
|
46
58
|
else
|
47
59
|
@global.format ||= 'json'
|
48
|
-
if @global.verbose ==
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
else
|
53
|
-
puts @report.dump(@global.format)
|
54
|
-
end
|
55
|
-
elsif @global.verbose >= 3
|
60
|
+
if @global.verbose == 0
|
61
|
+
metrics = @report.metrics_pack
|
62
|
+
puts metrics.dump(@global.format)
|
63
|
+
elsif @global.verbose >= 1
|
56
64
|
puts @run.dump(@global.format)
|
57
65
|
end
|
58
66
|
end
|
67
|
+
|
59
68
|
end
|
60
69
|
|
61
70
|
def example
|
data/lib/stella/report.rb
CHANGED
@@ -362,8 +362,9 @@ class Stella
|
|
362
362
|
end
|
363
363
|
|
364
364
|
field :processed => Boolean
|
365
|
+
field :runid
|
365
366
|
|
366
|
-
attr_reader :
|
367
|
+
attr_reader :timeline, :filter
|
367
368
|
def initialize(timeline=nil, runid=nil)
|
368
369
|
@timeline, @runid = timeline, runid
|
369
370
|
@processed = false
|
data/lib/stella/testplan.rb
CHANGED
@@ -23,7 +23,7 @@ class Stella
|
|
23
23
|
include Common::PrivacyMethods
|
24
24
|
prefix :testplan
|
25
25
|
index :id
|
26
|
-
field :id, :class => Gibbler::Digest, :meth => :gibbler
|
26
|
+
field :id, :class => Gibbler::Digest, :meth => :gibbler
|
27
27
|
field :custid => String
|
28
28
|
field :usecases => Array
|
29
29
|
field :desc => String
|
@@ -44,6 +44,10 @@ class Stella
|
|
44
44
|
@usecases << Stella::Usecase.new(req)
|
45
45
|
end
|
46
46
|
end
|
47
|
+
def id
|
48
|
+
@id ||= gibbler
|
49
|
+
@id
|
50
|
+
end
|
47
51
|
alias_method :planid, :id
|
48
52
|
def favicon?() !@favicon.nil? && !@favicon.empty? end
|
49
53
|
def preprocess
|
@@ -167,7 +171,7 @@ class Stella
|
|
167
171
|
end
|
168
172
|
class Usecase < Storable
|
169
173
|
include Gibbler::Complex
|
170
|
-
field :id, :class => Gibbler::Digest, :meth => :gibbler
|
174
|
+
field :id, :class => Gibbler::Digest, :meth => :gibbler
|
171
175
|
field :desc => String
|
172
176
|
field :ratio => Float
|
173
177
|
field :requests => Array
|
@@ -178,6 +182,10 @@ class Stella
|
|
178
182
|
preprocess
|
179
183
|
@requests << req if req
|
180
184
|
end
|
185
|
+
def id
|
186
|
+
@id ||= gibbler
|
187
|
+
@id
|
188
|
+
end
|
181
189
|
alias_method :ucid, :id
|
182
190
|
def preprocess
|
183
191
|
@requests ||= []
|
@@ -274,6 +282,10 @@ class Stella
|
|
274
282
|
|
275
283
|
class EventTemplate < Storable
|
276
284
|
include Gibbler::Complex
|
285
|
+
def id
|
286
|
+
@id ||= gibbler
|
287
|
+
@id
|
288
|
+
end
|
277
289
|
end
|
278
290
|
|
279
291
|
class StringTemplate
|
@@ -290,7 +302,7 @@ class Stella
|
|
290
302
|
end
|
291
303
|
|
292
304
|
class RequestTemplate < EventTemplate
|
293
|
-
field :id, :class => Gibbler::Digest, :meth => :gibbler
|
305
|
+
field :id, :class => Gibbler::Digest, :meth => :gibbler
|
294
306
|
field :protocol => Symbol
|
295
307
|
field :http_method
|
296
308
|
field :http_version
|
@@ -351,7 +363,7 @@ class Stella
|
|
351
363
|
index :id
|
352
364
|
include Familia::Stamps
|
353
365
|
include Common::PrivacyMethods
|
354
|
-
field :id, :class => Gibbler::Digest, :meth => :gibbler
|
366
|
+
field :id, :class => Gibbler::Digest, :meth => :gibbler
|
355
367
|
field :custid => String
|
356
368
|
field :status => Symbol
|
357
369
|
field :options => Hash
|
@@ -378,6 +390,10 @@ class Stella
|
|
378
390
|
}.merge options
|
379
391
|
preprocess
|
380
392
|
end
|
393
|
+
def id
|
394
|
+
@id ||= gibbler
|
395
|
+
@id
|
396
|
+
end
|
381
397
|
alias_method :runid, :id
|
382
398
|
def duration
|
383
399
|
return 0 unless @stime
|
@@ -400,7 +416,10 @@ class Stella
|
|
400
416
|
@id &&= Gibbler::Digest.new(@id)
|
401
417
|
# Calling plan calls Redis.
|
402
418
|
#@privacy = plan.privacy if Stella::Testplan === plan
|
403
|
-
|
419
|
+
if Hash === @report
|
420
|
+
@report = Stella::Report.from_hash @report
|
421
|
+
@report.runid = runid
|
422
|
+
end
|
404
423
|
@planid &&= Gibbler::Digest.new(@planid)
|
405
424
|
end
|
406
425
|
def hostid
|
@@ -432,7 +451,7 @@ class Stella
|
|
432
451
|
def plan
|
433
452
|
if @plan.nil?
|
434
453
|
@plan = Stella::Testplan.from_redis @planid
|
435
|
-
|
454
|
+
#@plan.freeze
|
436
455
|
end
|
437
456
|
@plan
|
438
457
|
end
|
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 = "2.0.
|
8
|
+
s.version = "2.0.3.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{2011-06
|
12
|
+
s.date = %q{2011-07-06}
|
13
13
|
s.default_executable = %q{stella}
|
14
14
|
s.description = %q{Define realistic testplans and run them against your webapps}
|
15
15
|
s.email = %q{delano@solutious.com}
|
@@ -41,6 +41,7 @@ Gem::Specification.new do |s|
|
|
41
41
|
"certs/startssl-sub.class1.server.ca.pem",
|
42
42
|
"certs/stella-master.crt",
|
43
43
|
"lib/stella.rb",
|
44
|
+
"lib/stella/api.rb",
|
44
45
|
"lib/stella/cli.rb",
|
45
46
|
"lib/stella/client.rb",
|
46
47
|
"lib/stella/core_ext.rb",
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: stella
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.0.
|
5
|
+
version: 2.0.3.001
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Delano Mandelbaum
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06
|
13
|
+
date: 2011-07-06 00:00:00 -04:00
|
14
14
|
default_executable: stella
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -144,6 +144,7 @@ files:
|
|
144
144
|
- certs/startssl-sub.class1.server.ca.pem
|
145
145
|
- certs/stella-master.crt
|
146
146
|
- lib/stella.rb
|
147
|
+
- lib/stella/api.rb
|
147
148
|
- lib/stella/cli.rb
|
148
149
|
- lib/stella/client.rb
|
149
150
|
- lib/stella/core_ext.rb
|