Permalink
Browse files

Merge branch 'master' of github.com:dbrady/tourbus

  • Loading branch information...
2 parents 4e1b0f8 + 24cb3fc commit d49de3e85eca9798624e6462895081b55f149bc3 David Brady committed Dec 29, 2010
Showing with 195 additions and 18 deletions.
  1. +8 −0 .yardoc/checksums
  2. BIN .yardoc/objects/File.dat
  3. BIN .yardoc/objects/File/here_c.dat
  4. BIN .yardoc/objects/Runner.dat
  5. BIN .yardoc/objects/Runner/host_i.dat
  6. BIN .yardoc/objects/Runner/initialize_i.dat
  7. BIN .yardoc/objects/Runner/log_i.dat
  8. BIN .yardoc/objects/Runner/number_i.dat
  9. BIN .yardoc/objects/Runner/run_tourists_i.dat
  10. BIN .yardoc/objects/Runner/runner_id_i.dat
  11. BIN .yardoc/objects/Runner/runner_type_i.dat
  12. BIN .yardoc/objects/Runner/tour_limited_to_i.dat
  13. BIN .yardoc/objects/Runner/tourists_i.dat
  14. BIN .yardoc/objects/TOURBUS_LIB_PATH.dat
  15. BIN .yardoc/objects/TourBus.dat
  16. BIN .yardoc/objects/TourBus/benchmarks_i.dat
  17. BIN .yardoc/objects/TourBus/concurrency_i.dat
  18. BIN .yardoc/objects/TourBus/errors_i.dat
  19. BIN .yardoc/objects/TourBus/fails_i.dat
  20. BIN .yardoc/objects/TourBus/host_i.dat
  21. BIN .yardoc/objects/TourBus/initialize_i.dat
  22. BIN .yardoc/objects/TourBus/log_i.dat
  23. BIN .yardoc/objects/TourBus/next_runner_id_i.dat
  24. BIN .yardoc/objects/TourBus/number_i.dat
  25. BIN .yardoc/objects/TourBus/passes_i.dat
  26. BIN .yardoc/objects/TourBus/run_i.dat
  27. BIN .yardoc/objects/TourBus/runners_i.dat
  28. BIN .yardoc/objects/TourBus/runs_i.dat
  29. BIN .yardoc/objects/TourBus/tests_i.dat
  30. BIN .yardoc/objects/TourBus/total_runs_i.dat
  31. BIN .yardoc/objects/TourBus/tourists_i.dat
  32. BIN .yardoc/objects/TourBus/update_benchmarks_i.dat
  33. BIN .yardoc/objects/TourBus/update_stats_i.dat
  34. BIN .yardoc/objects/TourBusException.dat
  35. BIN .yardoc/objects/TourProxy.dat
  36. BIN .yardoc/objects/TourProxy/dump_request_i.dat
  37. BIN .yardoc/objects/TourProxy/dump_response_i.dat
  38. BIN .yardoc/objects/TourProxy/initialize_i.dat
  39. BIN .yardoc/objects/TourProxy/log_request_as_webrat_i.dat
  40. BIN .yardoc/objects/TourProxy/run_server_21_c.dat
  41. BIN .yardoc/objects/TourProxy/shutdown_i.dat
  42. BIN .yardoc/objects/TourProxy/start_i.dat
  43. BIN .yardoc/objects/TourRat.dat
  44. BIN .yardoc/objects/TourRat/ClassMethods.dat
  45. BIN .yardoc/objects/TourRat/InstanceMethods.dat
  46. BIN .yardoc/objects/TourRat/included_c.dat
  47. BIN .yardoc/objects/TourWatch.dat
  48. BIN .yardoc/objects/TourWatch/bargraph_i.dat
  49. BIN .yardoc/objects/TourWatch/fields_i.dat
  50. BIN .yardoc/objects/TourWatch/fields_linux_i.dat
  51. BIN .yardoc/objects/TourWatch/fields_mac_i.dat
  52. BIN .yardoc/objects/TourWatch/initialize_i.dat
  53. BIN .yardoc/objects/TourWatch/log_i.dat
  54. BIN .yardoc/objects/TourWatch/processes_i.dat
  55. BIN .yardoc/objects/TourWatch/run_i.dat
  56. BIN .yardoc/objects/TourWatch/stats_i.dat
  57. BIN .yardoc/objects/TourWatch/top_linux_i.dat
  58. BIN .yardoc/objects/TourWatch/top_mac_i.dat
  59. BIN .yardoc/objects/Tourist.dat
  60. BIN .yardoc/objects/Tourist/after_tours_i.dat
  61. BIN .yardoc/objects/Tourist/before_tours_i.dat
  62. BIN .yardoc/objects/Tourist/host_i.dat
  63. BIN .yardoc/objects/Tourist/initialize_i.dat
  64. BIN .yardoc/objects/Tourist/log_i.dat
  65. BIN .yardoc/objects/Tourist/make_tourist_c.dat
  66. BIN .yardoc/objects/Tourist/number_i.dat
  67. BIN .yardoc/objects/Tourist/run_tour_i.dat
  68. BIN .yardoc/objects/Tourist/session_i.dat
  69. BIN .yardoc/objects/Tourist/setup_i.dat
  70. BIN .yardoc/objects/Tourist/teardown_i.dat
  71. BIN .yardoc/objects/Tourist/tour_type_i.dat
  72. BIN .yardoc/objects/Tourist/tourist_3F_c.dat
  73. BIN .yardoc/objects/Tourist/tourist_id_i.dat
  74. BIN .yardoc/objects/Tourist/tourists_c.dat
  75. BIN .yardoc/objects/Tourist/tours_c.dat
  76. BIN .yardoc/objects/Tourist/tours_i.dat
  77. BIN .yardoc/objects/Tourist/wait_i.dat
  78. BIN .yardoc/objects/WebratError.dat
  79. BIN .yardoc/objects/require_all_files_in_folder_i.dat
  80. BIN .yardoc/objects/root.dat
  81. BIN .yardoc/proxy_types
  82. +20 −3 TODO
  83. +1 −1 bin/tourbus
  84. +10 −0 bin/tourproxy
  85. +11 −0 lib/file.rb
  86. +82 −0 lib/tour_proxy.rb
  87. +19 −0 spec/lib/tourproxy_spec.rb
  88. +22 −0 spec/spec_helper.rb
  89. +22 −14 tourbus.gemspec
View
@@ -0,0 +1,8 @@
+lib/tour_rat.rb 0499f31e2256d338ed68dd385b9b48b397a33e1b
+lib/tourist.rb 795cdf5075cd728d4e1665705335fcd099a246d6
+lib/tour_watch.rb cdcbd2189992948dd9b769bd0b947feabe228834
+lib/tour_proxy.rb 7635591d97ddf885d70f8e2dc02d20f4d8ac758f
+lib/runner.rb df2672b86c3350e0db38cb10a750bc5e1227778e
+lib/file.rb 97d45fcd028220b74be47a7af3deb3432ad48f1d
+lib/tour_bus.rb 5b787c820bd8bd2656d65b2eec576167f7a47ec4
+lib/common.rb c61e96662d25eabc72ae81caa96b5c19c489cd7e
View
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
23 TODO
@@ -4,17 +4,34 @@ TODO
Tourbus 2.0 Todo
----------------------------------------------------------------------
-- Change naming. Several people have asked me
-- Change test_ to tour_.
+- Change naming. Several people have asked me to change test_* to
+ tour_*.
Ahh, I remember now why I never did this. The *class* is called
Tour. Calling a test *method* tour_ as well led me quickly to
confusion. To rename test_ to tour_, I'd really want to rename the
Tour class to something like Tourist.
+ Hmm, I like this. And also in keeping, should probably consider
+ renaming Runner to something like TourGuide--something that leads
+ Tourists on many Tours.
+
- Look at RSpec style declarations? describe, before(:each) do etc?
+ Also would like rspec matchers, e.g. response.should be_success
+
+- Continuous mode? Launch tourbus and keep running until I say stop.
+
+- GUI? Ugh. Remote connection is blargh, but it WOULD be nice to be
+ able to see running state and have controls to ramp the load up and
+ down by changing concurrency and some sort of sleep/wait time
+ between runs and tours.
+
+- before(:each): Runs before each tour.
+- before(:tours): Runs before all tours in this Tourist
+- before(:everything): Runs once before ANY tours run ever.
+ after(:everything) runs after ALL tours have completed.
+
-- before(:all), before(:suite)
- tour_proxy - capture sessions, including AMF
View
@@ -36,7 +36,7 @@ srand opts[:rand] || Time.now.to_i
if opts[:list]
Tourist.tourists(ARGV).each do |tourist|
puts tourist
- puts Tourist.tests(tourist).map {|test| " #{test}"}
+ puts Tourist.tours(tourist).map {|test| " #{test}"}
end
else
opts[:tests] = opts[:tests].split(',') if opts[:tests]
View
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+# This proxy logger logs x-amf traffic, and is stolen with gratitude from http://altentee.com/2008/performance-testing-flex-remoting-amf-with-jmeter/
+
+require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'tour_proxy'))
+
+options = {}
+
+proxy = TourProxy.new options
+trap "INT" do proxy.shutdown end
+proxy.start
View
@@ -0,0 +1,11 @@
+class File
+ # Hides all that lovely expand/join/dirname(__FILE__, path) crap
+ #
+ # E.g.: require File.here("../lib/pants")
+ #
+ # Splatty version for the OS Agnosts out there:
+ # require File.here(%w[.. lib pants])
+ def self.here(*args)
+ p = File.expand_path(File.join(File.dirname(caller.first.split(':')[0]), *args))
+ end
+end
View
@@ -0,0 +1,82 @@
+require 'webrick/httpproxy'
+require 'ruby-debug'
+
+class TourProxy
+ # Initialize the proxy object.
+ #
+ # @param [Hash] options list of options to configure the proxy.
+ # @option options [Fixnum] :port Port number to listen on
+ # @option options [Hash] :hostnames hostnames by name => url
+ # @option options [IO] :output_buffer IO object to write output to
+ def initialize(options={})
+ @server = nil
+ @output_buffer = options[:output_buffer] || STDOUT
+ @server = WEBrick::HTTPProxyServer.new(
+ :Port => options[:port] || 8080,
+ :RequestCallback => Proc.new do |req,res|
+ log_request_as_webrat(req)
+ # dump_request(req)
+ # puts(("<" * 100) + " END CALLBACK")
+ end
+ )
+ end
+
+ def log_request_as_webrat(request)
+ return unless @output_buffer
+# puts "> log_request_as_webrat"
+ body = request.body
+ if body
+ items = body.split(/&/)
+ pairs = items.map{ |e| e.split(/=/,2)}
+ hash = Hash[pairs]
+ @output_buffer.puts "visit '#{request.request_uri}', :#{request.request_method.downcase}, #{hash.inspect}"
+ else
+ @output_buffer.puts "visit '#{request.request_uri}', :#{request.request_method.downcase}"
+ end
+# puts "< log_request_as_webrat"
+ end
+
+ # Dumps an HTTPRequest object
+ def dump_request(request)
+ return unless @output_buffer
+ puts "> dump_request"
+ terms = %w(request_uri request_line raw_header body)
+ longest = terms.map(&:size).max
+
+ @output_buffer.puts '-' * 80
+ @output_buffer.puts "Request:"
+ terms.each do |term|
+ @output_buffer.puts " %#{longest}s:" % [term] # , request.send(term).to_s.length]
+ end
+ @output_buffer.puts '-' * 80
+ @output_buffer.flush
+ puts "< dump_request"
+ end
+
+ # Dumps an HTTPResponse object
+ def dump_response(response)
+ return unless @output_buffer
+ puts "> dump_response"
+ terms = %w()
+ longest = terms.map(&:size).max
+
+ @output_buffer.puts '-' * 80
+ @output_buffer.puts "Response:"
+ terms.each do |term|
+ @output_buffer.puts " %#{longest}s: %s" % [term, response.send(term).to_s]
+ end
+ @output_buffer.puts '-' * 80
+ @output_buffer.flush
+ puts "< dump_response"
+ end
+
+ def start
+ @server.start
+ end
+
+ def shutdown
+ @server.shutdown
+ end
+end
+
+
View
@@ -0,0 +1,19 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe TourProxy do
+ it "should replace known hostnames"
+ # given a list of known hostnames,
+ # when I process a request matching a hosts,
+ # then the request uri should be rewritten with the variable's expansion
+
+ it "should emit AMF blobs"
+ it "should emit get/post blobs for unrecognized types"
+
+ # when doing an html get
+ # with no params
+ # it should log "visit 'url'"
+ # and should not log "visit 'url', :get" etc
+
+
+end
+
View
@@ -0,0 +1,22 @@
+# This file is copied to ~/spec when you run 'ruby script/generate rspec'
+# from the project root directory.
+require File.expand_path(File.join(File.dirname(__FILE__), '../lib/file'))
+require 'spec/autorun'
+require 'ruby-debug'
+# require File.here('../features/factories/fixjour_definitions')
+# require File.here('../test/bdrb_test_helper')
+
+# Requires all files in a folder relative to .. (project root).
+def require_all_files_in_folder(folder, extension = '*.rb')
+ for file in Dir[File.join(File.expand_path(File.dirname(__FILE__)), '..', folder, "**/#{extension}")]
+ require file
+ end
+end
+
+# Uncomment the next line to use webrat's matchers
+#require 'webrat/integrations/rspec-rails'
+
+# Requires supporting files with custom matchers and macros, etc,
+# in ./support/ and its subdirectories.
+require_all_files_in_folder "spec/support"
+require_all_files_in_folder "lib"
View
@@ -1,14 +1,14 @@
spec = Gem::Specification.new do |s|
s.name = 'tourbus'
- s.version = '0.9.00'
- s.date = '2010-09-01'
+ s.version = '0.9.01'
+ s.date = '2010-09-23'
s.summary = 'TourBus web stress-testing tool'
s.email = "github@shinybit.com"
s.homepage = "http://github.com/dbrady/tourbus/"
s.description = "TourBus, a web load-testing tool that combines complex 'tour' definitions with scalable, concurrent testing"
s.has_rdoc = true
s.rdoc_options = ["--line-numbers", "--inline-source", "--main", "README.rdoc", "--title", "Tourbus - Web Load Testing in Ruby"]
- s.executables = ["tourbus", "tourwatch"]
+ s.executables = ["tourbus", "tourwatch", "tourproxy"]
s.extra_rdoc_files = ["README.rdoc", "MIT-LICENSE", "examples/contact_app/README.rdoc"]
s.authors = ["David Brady", "James Britt", "JT Zemp", "Tim Harper", "Joe Tanner"]
s.add_dependency('mechanize', '>= 1.0.0')
@@ -19,16 +19,24 @@ spec = Gem::Specification.new do |s|
# ruby -rpp -e "pp (Dir['{README,{examples,lib,protocol,spec}/**/*.{rdoc,json,rb,txt,xml,yml}}'] + Dir['bin/*']).map.sort"
- s.files = ["bin/tourbus",
- "bin/tourwatch",
- "examples/contact_app/README.rdoc",
- "examples/contact_app/contact_app.rb",
- "examples/contact_app/tours/simple.rb",
- "examples/contact_app/tours/tourbus.yml",
- "lib/common.rb",
- "lib/runner.rb",
- "lib/tour.rb",
- "lib/tour_bus.rb",
- "lib/tour_watch.rb"]
+ s.files = [
+ "bin/tourbus",
+ "bin/tourproxy",
+ "bin/tourwatch",
+ "examples/contact_app/README.rdoc",
+ "examples/contact_app/contact_app.rb",
+ "examples/contact_app/tours/simple.rb",
+ "examples/contact_app/tours/tourbus.yml",
+ "lib/common.rb",
+ "lib/file.rb",
+ "lib/runner.rb",
+ "lib/tour_bus.rb",
+ "lib/tour_proxy.rb",
+ "lib/tour_rat.rb",
+ "lib/tour_watch.rb",
+ "lib/tourist.rb",
+ "spec/lib/tourproxy_spec.rb",
+ "spec/spec_helper.rb"
+ ]
end

0 comments on commit d49de3e

Please sign in to comment.