stella 0.7.0.015 → 0.7.0.017

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.
@@ -1,13 +1,13 @@
1
1
  STELLA, CHANGES
2
2
 
3
3
 
4
- #### 0.7.0 (2009-09-05) ###############################
4
+ #### 0.7.0 (2009-10-??) ###############################
5
5
 
6
- NOTE: Complete rewrite
6
+ NOTE: Complete rewrite. Features include:
7
7
 
8
8
  * New internal architecture.
9
9
  * Improved stability and output for high thread loads.
10
- * Updated configuration
10
+ * Updated configuration syntax
11
11
  * Granular reporting via Benelux
12
12
 
13
13
 
@@ -2,9 +2,6 @@
2
2
 
3
3
  <b>Perform load tests on your web applications with beauty and brute strength.</b>
4
4
 
5
-
6
-
7
-
8
5
  == Features
9
6
 
10
7
  * Realistic load simulation
@@ -27,9 +24,8 @@ This is an early preview of Stella. The following features are still under devel
27
24
  # by running a single user functional test.
28
25
  $ stella verify -p examples/basic/plan.rb http://stellaaahhhh.com/
29
26
 
30
- # Perform a load test
31
- # using the same test plan.
32
- $ stella load -p examples/basic/plan.rb http://stellaaahhhh.com/
27
+ # Generate requests using the same test plan.
28
+ $ stella generate -p examples/basic/plan.rb http://stellaaahhhh.com/
33
29
 
34
30
 
35
31
  == Test Plan Example
data/Rudyfile CHANGED
@@ -68,10 +68,10 @@ routines do
68
68
  end
69
69
  end
70
70
 
71
- # rudy -v -r gen stress ip-10-251-27-245.ec2.internal:3114
72
- stress do
71
+ # rudy -v -r gen generate ip-10-251-27-245.ec2.internal:3114
72
+ generate do
73
73
  remote do |arg|
74
- stella :v, 'stress', :c, 50, :r, 4, "#{arg.first}"
74
+ stella :v, 'generate', :c, 50, :r, 4, "#{arg.first}"
75
75
  end
76
76
  end
77
77
 
data/bin/stella CHANGED
@@ -36,8 +36,9 @@ class Stella::CLI::Definition
36
36
  # ---------------------------------------- STELLA GLOBALS --------
37
37
  # ------------------------------------------------------------------
38
38
 
39
- global :A, :apikey, String, "API Key"
40
- global :S, :secret, String, "Secret Key"
39
+ #global :A, :apikey, String, "API Key"
40
+ #global :S, :secret, String, "Secret Key"
41
+ global :p, :pause, Integer, "Seconds to pause before starting test"
41
42
  global :n, :nocolor, "Disable output colors" do
42
43
  String.disable_color
43
44
  end
@@ -63,43 +64,45 @@ class Stella::CLI::Definition
63
64
  usage "stella example"
64
65
  command :example => Stella::CLI
65
66
 
66
- about "Preview the test plan"
67
+ about "Preview a test plan"
67
68
  usage "stella preview [-p path/2/testplan.rb] "
69
+ option :c, :clients, Integer, "Maximum number of virtual clients (ignored)"
70
+ option :r, :repetitions, Integer, "Number of times to repeat the testplan (ignored)"
71
+ option :d, :duration, String, "Max duration to run test (ignored)"
72
+ option :W, :nowait, "Ignore wait times (ignored)"
73
+ option :w, :wait, Float, "Wait time (in seconds) between client requests (ignored if testplan supplied)"
68
74
  option :p, :testplan, String, "Path to testplan"
69
75
  command :preview => Stella::CLI
70
76
 
71
- about "Run a functional test"
72
- usage "stella verify http://stellaaahhhh.com/"
73
- usage "stella verify -p path/2/testplan.rb http://stellaaahhhh.com/"
77
+ about "Verify a test plan"
78
+ usage "stella verify [-p path/2/testplan.rb] URI"
79
+ usage "e.g."
80
+ usage " $stella verify -p path/2/testplan.rb http://stellaaahhhh.com/"
81
+ option :c, :clients, Integer, "Maximum number of virtual clients (ignored)"
82
+ option :r, :repetitions, Integer, "Number of times to repeat the testplan (ignored)"
83
+ option :d, :duration, String, "Max duration to run test (ignored)"
74
84
  option :W, :nowait, "Ignore wait times"
75
85
  option :w, :wait, Float, "Wait time (in seconds) between client requests (ignored if testplan supplied)"
76
86
  option :p, :testplan, String, "Path to testplan"
77
87
  command :verify => Stella::CLI
78
88
 
79
- about "Run a load test"
80
- usage "stella load http://stellaaahhhh.com/"
81
- usage "stella load http://stellaaahhhh.com:3114/"
82
- usage "stella load --clients=10 --repetitions=2 http://stellaaahhhh.com/"
83
- usage "stella load -p path/2/testplan.rb -u 100 -r 5 http://stellaaahhhh.com/"
84
- option :c, :clients, Integer, "Number of virtual clients"
89
+ about "Generate requests"
90
+ usage "stella generate [options] URI"
91
+ #usage "stella load [options] URI"
92
+ #usage "stella stress [options] URI"
93
+ usage "e.g. "
94
+ usage " $ stella generate -p path/2/testplan.rb -u 100 -r 50 http://stellaaahhhh.com:3114/"
95
+ #usage " $ stella stress --clients=50 --repetitions=20 http://stellaaahhhh.com/"
96
+ option :c, :clients, Integer, "Maximum number of virtual clients"
85
97
  option :r, :repetitions, Integer, "Number of times to repeat the testplan (per vclient)"
86
98
  option :d, :duration, String, "Max duration to run test"
87
99
  option :W, :nowait, "Ignore wait times"
88
100
  option :w, :wait, Float, "Wait time (in seconds) between client requests (ignored if testplan supplied)"
89
101
  option :p, :testplan, String, "Path to testplan"
90
- command :load => Stella::CLI
91
-
92
- about "Run a stress test"
93
- usage "stella stress http://stellaaahhhh.com/"
94
- usage "stella stress http://stellaaahhhh.com:3114/"
95
- usage "stella stress --clients=10 --repetitions=2 http://stellaaahhhh.com/"
96
- usage "stella stress -p path/2/testplan.rb -u 100 -r 5 http://stellaaahhhh.com/"
97
- option :c, :clients, Integer, "Number of virtual clients"
98
- option :r, :repetitions, Integer, "Number of times to repeat the testplan (per vclient)"
99
- option :d, :duration, String, "Max duration to run test"
100
- option :p, :testplan, String, "Path to testplan"
101
- command :stress => Stella::CLI
102
-
102
+ command :generate => Stella::CLI
103
+ # command_alias :generate, :load
104
+ # command_alias :generate, :stress
105
+
103
106
  about "Initialize Stella configuration"
104
107
  command :init do
105
108
  Stella::Config.init
@@ -117,8 +120,15 @@ class Stella::CLI::Definition
117
120
  # ------------------------------------------------------------------
118
121
 
119
122
  before do |obj|
123
+ #puts $$
120
124
  @start = Time.now
121
- Stella.enable_debug if Drydock.debug?
125
+ if obj.global.pause
126
+ obj.global.pause.to_i.times do |i|
127
+ print "Waiting for %s" % [(obj.global.pause-i)]
128
+ sleep 1
129
+ print "\r%30s\r" % '' # clear line
130
+ end
131
+ end
122
132
  end
123
133
 
124
134
  after do |obj|
@@ -141,6 +151,8 @@ rescue Drydock::ArgError, Drydock::OptError => ex
141
151
  STDERR.puts ex.usage
142
152
  rescue Drydock::InvalidArgument => ex
143
153
  STDERR.puts ex.message
154
+ rescue Drydock::UnknownCommand => ex
155
+ STDERR.puts "Unknown command: %s" % ex.name
144
156
  rescue Stella::Error => ex
145
157
  STDERR.puts ex.message
146
158
  STDERR.puts ex.backtrace if Stella.loglev > 2 || Drydock.debug?
@@ -1,3 +1,9 @@
1
+ # Stella Test Plan - Cookies (2009-10-08)
2
+ #
3
+ # TO BE DOCUMENTED.
4
+ #
5
+ # If you're reading this, remind me!
6
+ #
1
7
  desc "Maintain Your Cookies"
2
8
 
3
9
  usecase 65, "Simple search" do
@@ -15,4 +21,6 @@ usecase 65, "Simple search" do
15
21
  end
16
22
  end
17
23
 
18
- end
24
+ end
25
+
26
+ # c88c5e4e8c72e305928c8e512ca1e26baf271544
@@ -0,0 +1,27 @@
1
+ # Stella Test Plan - Reading CSV Data (2009-10-08)
2
+ #
3
+ # TO BE DOCUMENTED.
4
+ #
5
+ # If you're reading this, remind me!
6
+ #
7
+
8
+ usecase "Reading CSV Data" do
9
+ resource :search_terms, csv('search_terms.csv')
10
+
11
+ get "/search", "Search (random)" do
12
+ param :what => random(:search_terms, 0)
13
+ param :where => random(:search_terms, 1)
14
+ end
15
+
16
+ get "/search", "Search (sequential #1)" do
17
+ param :what => sequential(:search_terms, 0)
18
+ param :where => sequential(:search_terms, 1)
19
+ end
20
+
21
+ get "/search", "Search (sequential #2)" do
22
+ param :what => sequential(:search_terms, 0)
23
+ param :where => sequential(:search_terms, 1)
24
+ end
25
+ end
26
+
27
+ # d93df136283f3867f462266a98675ce0b2f51b08
@@ -0,0 +1,14 @@
1
+ west,toronto
2
+ smoked,toronto
3
+ pen,toronto
4
+ fire,toronto
5
+ ink,to
6
+ town,toronto
7
+ big,montreal
8
+ ti,on
9
+ al,montreal
10
+ furniture,mont
11
+ keyboard,montreal
12
+ rods,toronto
13
+ beads,montreal
14
+ fu,montreal
@@ -1,4 +1,4 @@
1
- # Stella - Example Test Plan
1
+ # Stella Test Plan - Essentials (2009-10-08)
2
2
  #
3
3
  #
4
4
  # 1. INTRODUCTION
@@ -57,11 +57,11 @@
57
57
  # The "verify" command executes the plan with a
58
58
  # single user and provides more detailed output.
59
59
  #
60
- # "load" tests are run in a similar way:
60
+ # And this is how you generate load:
61
61
  #
62
- # $ stella load -c 50 -r 10 -p examples/essentials/plan.rb http://127.0.0.1:3114/
62
+ # $ stella generate -c 50 -r 10 -p examples/essentials/plan.rb http://127.0.0.1:3114/
63
63
  #
64
- # where "c" is the number of concurrent users and
64
+ # where "c" is the number of concurrent clients,
65
65
  # "r" is the number of times to repeat the plan.
66
66
  #
67
67
  #
@@ -89,7 +89,7 @@ usecase 65, "Simple search" do
89
89
  # into an array called :search_terms. The
90
90
  # colon is Ruby's way of defining a symbol.
91
91
  #
92
- resource :search_terms, list('search_terms.csv')
92
+ resource :search_terms, list('search_terms.txt')
93
93
 
94
94
  # Requests are defined with one of the
95
95
  # following methods: get, post, head, delete.
@@ -244,4 +244,4 @@ usecase 10, "Self-serve API" do
244
244
 
245
245
  end
246
246
 
247
- # 278a014c48dd64d2f2aca0588fa281b9553e825f
247
+ # 80661e5f4c731ed905b01fdcdb52896629c7dd1e
@@ -1,4 +1,9 @@
1
-
1
+ # Stella Test Plan - Exception Handling (2009-10-08)
2
+ #
3
+ # TO BE DOCUMENTED.
4
+ #
5
+ # If you're reading this, remind me!
6
+ #
2
7
 
3
8
  usecase "Exception Handling" do
4
9
 
@@ -10,4 +15,6 @@ usecase "Exception Handling" do
10
15
  end
11
16
  end
12
17
 
13
- end
18
+ end
19
+
20
+ # 0f354b3579e6c5b5b3f303aabb2ac3aa5b11096a
@@ -1,59 +1,79 @@
1
1
 
2
- require 'ostruct'
2
+ STELLA_LIB_HOME = File.expand_path File.dirname(__FILE__) unless defined?(STELLA_LIB_HOME)
3
+
4
+ %w{attic hexoid storable sysinfo gibbler benelux}.each do |dir|
5
+ $:.unshift File.join(STELLA_LIB_HOME, '..', '..', dir, 'lib')
6
+ end
7
+
8
+ autoload :SysInfo, 'sysinfo'
9
+ autoload :Drydock, 'drydock'
10
+ autoload :URI, 'uri'
11
+ autoload :OpenStruct, 'ostruct'
12
+ autoload :Storable, 'storable'
13
+ autoload :Gibbler, 'gibbler/aliases'
14
+ autoload :Attic, 'attic'
15
+
16
+ require 'benelux'
3
17
  require 'threadify'
18
+ require 'tracer'
19
+
20
+
4
21
 
5
22
  module Stella
6
23
  extend self
7
-
8
- LIB_HOME = File.expand_path File.dirname(__FILE__) unless defined?(LIB_HOME)
9
24
 
10
- %w{storable sysinfo gibbler benelux}.each do |dir|
11
- $:.unshift File.join(LIB_HOME, '..', '..', dir, 'lib')
25
+ SLEEP_METRICS = {
26
+ :create_thread => 0.001,
27
+ :check_threads => 0.3
28
+ }.freeze unless defined?(SLEEP_METRICS)
29
+
30
+ @sysinfo = nil
31
+ @logger = Drydock::Screen
32
+ @loglev = 1
33
+ @debug = false
34
+ @abort = false
35
+
36
+ class << self
37
+ attr_accessor :loglev, :logger
12
38
  end
13
- require 'sysinfo'
14
- require 'drydock/screen'
15
- require 'storable'
16
- require 'gibbler'
17
- require 'gibbler/aliases'
18
- require 'benelux'
19
39
 
20
- @@sysinfo = SysInfo.new.freeze
21
- @@logger = Drydock::Screen
22
- @@loglev = 1
23
- @@debug = false
24
- @@abort = false
40
+ def sleep(metric)
41
+ unless SLEEP_METRICS.has_key? metric
42
+ raise "unknown sleep metric: #{metric}"
43
+ end
44
+ Kernel.sleep SLEEP_METRICS[metric]
45
+ end
25
46
 
26
- # Puts +msg+ to +@@logger+
27
- def lflush; @@logger.flush if @@logger.respond_to? :flush; end
28
- def li(*msg); msg.each { |m| @@logger.puts m } if !quiet? end
29
- def li1(*msg); li *msg if @@loglev >= 1 end
30
- def li2(*msg); li *msg if @@loglev >= 2 end
31
- def li3(*msg); li *msg if @@loglev >= 3 end
32
- def li4(*msg); li *msg if @@loglev >= 4 end
47
+ # Puts +msg+ to +@logger+
48
+ def lflush; @logger.flush if @logger.respond_to? :flush; end
49
+ def li(*msg); msg.each { |m| @logger.puts m } if !quiet? end
50
+ def li1(*msg); li *msg if @loglev >= 1 end
51
+ def li2(*msg); li *msg if @loglev >= 2 end
52
+ def li3(*msg); li *msg if @loglev >= 3 end
53
+ def li4(*msg); li *msg if @loglev >= 4 end
33
54
 
34
- # Puts +msg+ to +@@logger+ with "ERROR: " prepended
35
- def le(*msg); @@logger.puts " " << msg.join("#{$/} ").color(:red); end
36
- # Puts +msg+ to +@@logger+ if +Rudy.debug?+ returns true
55
+ # Puts +msg+ to +@logger+ with "ERROR: " prepended
56
+ def le(*msg); @logger.puts " " << msg.join("#{$/} ").color(:red); end
57
+ # Puts +msg+ to +@logger+ if +Rudy.debug?+ returns true
37
58
  def ld(*msg)
38
- @@logger.puts "D: " << msg.join("#{$/}D: ") if debug?
59
+ @logger.puts "D: " << msg.join("#{$/}D: ") if debug?
39
60
  end
40
61
 
41
- def loglev; @@loglev; end
42
- def loglev=(val); @@loglev = val; end
43
- def sysinfo; @@sysinfo; end
62
+ def sysinfo
63
+ @sysinfo = SysInfo.new.freeze if @sysinfo.nil?
64
+ @sysinfo
65
+ end
44
66
 
45
- def quiet?; @@loglev == 0; end
46
- def enable_quiet; @@loglev = 0; end
47
- def disable_quiet; @@loglev = 1; end
67
+ def quiet?() @loglev == 0 end
68
+ def enable_quiet() @loglev = 0 end
69
+ def disable_quiet() @loglev = 1 end
48
70
 
49
- def debug?; @@debug == true; end
50
- def enable_debug; @@debug = true; end
51
- def disable_debug; @@debug = false; end
71
+ def debug?() @debug == true end
72
+ def enable_debug() @debug = true end
73
+ def disable_debug() @debug = false end
52
74
 
53
- def abort?
54
- @@abort == true
55
- end
56
- def abort!() @@abort = true end
75
+ def abort?() @abort == true end
76
+ def abort!() @abort = true end
57
77
 
58
78
  def rescue(&blk)
59
79
  blk.call
@@ -61,15 +81,20 @@ module Stella
61
81
  Stella.le "ERROR: #{ex.message}"
62
82
  Stella.li3 ex.backtrace
63
83
  end
84
+
85
+ require 'stella/exceptions'
86
+
87
+ autoload :VERSION, 'stella/version'
88
+ autoload :Utils, 'stella/utils'
89
+ autoload :Config, 'stella/config'
90
+ autoload :Data, 'stella/data'
91
+ autoload :Testplan, 'stella/testplan'
92
+ autoload :Engine, 'stella/engine'
93
+ autoload :Client, 'stella/client'
94
+
95
+ require 'stella/mixins'
64
96
  end
65
97
 
66
- require 'stella/version'
67
- require 'stella/exceptions'
68
- require 'stella/utils'
69
- require 'stella/config'
70
- require 'stella/data'
71
- require 'stella/client'
72
98
 
73
- Stella::Utils.require_vendor "httpclient", '2.1.5.2'
74
- Stella::Utils.require_glob(Stella::LIB_HOME, 'stella', '*.rb')
99
+
75
100
 
@@ -1,5 +1,4 @@
1
1
 
2
-
3
2
  class Stella::CLI < Drydock::Command
4
3
  attr_accessor :exit_code
5
4
 
@@ -20,36 +19,22 @@ class Stella::CLI < Drydock::Command
20
19
  @exit_code = (ret ? 0 : 1)
21
20
  end
22
21
 
23
- def load_valid?
22
+ def generate_valid?
24
23
  create_testplan
25
24
  end
26
25
 
27
- def load
26
+ def generate
28
27
  opts = {}
29
28
  opts[:hosts] = @hosts
30
- [:nowait, :clients, :repetitions, :wait, :duration].each do |opt|
29
+ [:nowait, :clients, :repetitions, :duration].each do |opt|
31
30
  opts[opt] = @option.send(opt) unless @option.send(opt).nil?
32
31
  end
33
32
  ret = Stella::Engine::Load.run @testplan, opts
34
33
  @exit_code = (ret ? 0 : 1)
35
34
  end
36
35
 
37
- def stress_valid?
38
- create_testplan
39
- end
40
-
41
- def stress
42
- opts = {}
43
- opts[:hosts] = @hosts
44
- [:clients, :repetitions, :duration].each do |opt|
45
- opts[opt] = @option.send(opt) unless @option.send(opt).nil?
46
- end
47
- ret = Stella::Engine::Stress.run @testplan, opts
48
- @exit_code = (ret ? 0 : 1)
49
- end
50
-
51
36
  def example
52
- base_path = File.expand_path(File.join(Stella::LIB_HOME, '..'))
37
+ base_path = File.expand_path(File.join(STELLA_LIB_HOME, '..'))
53
38
  thin_path = File.join(base_path, 'support', 'sample_webapp', 'config.ru')
54
39
  webrick_path = File.join(base_path, 'support', 'sample_webapp', 'app.rb')
55
40
  tp_path = File.join(base_path, 'examples', 'essentials', 'plan.rb')
@@ -63,13 +48,13 @@ class Stella::CLI < Drydock::Command
63
48
  puts %Q{
64
49
  http://127.0.0.1:3114/
65
50
  }
66
- puts "3. Run a functional test:".bright
51
+ puts "3. Verify the testplan is correct (functional test):".bright
67
52
  puts %Q{
68
53
  $ stella verify -p #{tp_path} 127.0.0.1:3114
69
54
  }
70
- puts "4. Run a load test:".bright
55
+ puts "4. Generate requests (load test):".bright
71
56
  puts %Q{
72
- $ stella load -p #{tp_path} 127.0.0.1:3114
57
+ $ stella generate -p #{tp_path} 127.0.0.1:3114
73
58
  }
74
59
  end
75
60
 
@@ -91,10 +76,11 @@ class Stella::CLI < Drydock::Command
91
76
  @testplan = Stella::Testplan.load_file @option.testplan
92
77
  else
93
78
  opts = {}
94
- opts[:delay] = @option.wait if @option.wait
79
+ opts[:wait] = @option.wait if @option.wait
95
80
  @testplan = Stella::Testplan.new(@argv, opts)
96
81
  end
97
82
  @testplan.check! # raise errors, update usecase ratios
83
+ @testplan.freeze # cascades through usecases and requests
98
84
  Stella.li2 " #{@option.testplan || @testplan.desc} (#{@testplan.digest})"
99
85
  true
100
86
  end