right_support 2.8.12 → 2.8.15
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/.rspec +0 -1
- data/Gemfile +15 -21
- data/Gemfile.lock +59 -83
- data/Rakefile +0 -4
- data/VERSION +1 -1
- data/features/hash_tools.feature +27 -0
- data/features/step_definitions/hash_tools_steps.rb +41 -0
- data/lib/right_support/db/cassandra_model.rb +123 -109
- data/lib/right_support/log/mixin.rb +9 -2
- data/lib/right_support/rack/request_logger.rb +41 -28
- data/right_support.gemspec +14 -31
- data/right_support.rconf +4 -2
- data/spec/db/cassandra_model_part1_spec.rb +1 -1
- data/spec/db/cassandra_model_spec.rb +2 -2
- data/spec/log/mixin_spec.rb +29 -0
- data/spec/net/request_balancer_spec.rb +0 -1
- data/spec/rack/request_logger_spec.rb +39 -0
- data/spec/spec_helper.rb +0 -3
- metadata +36 -106
- data/features/continuous_integration.feature +0 -51
- data/features/continuous_integration_cucumber.feature +0 -28
- data/features/continuous_integration_rspec1.feature +0 -28
- data/features/continuous_integration_rspec2.feature +0 -28
| @@ -25,6 +25,7 @@ module RightSupport::Log | |
| 25 25 | 
             
              #
         | 
| 26 26 | 
             
              # === Basic Usage
         | 
| 27 27 | 
             
              # Your class must opt into logging by including the mixin:
         | 
| 28 | 
            +
              #
         | 
| 28 29 | 
             
              #   class AwesomenessProcessor
         | 
| 29 30 | 
             
              #     include RightSupport::Log::Mixin
         | 
| 30 31 | 
             
              #
         | 
| @@ -36,7 +37,7 @@ module RightSupport::Log | |
| 36 37 | 
             
              #   end
         | 
| 37 38 | 
             
              #
         | 
| 38 39 | 
             
              #   def process_awesomeness(input)
         | 
| 39 | 
            -
              #     input = self.class. | 
| 40 | 
            +
              #     input = self.class.prepare_awesomeness_for_processing(input)
         | 
| 40 41 | 
             
              #     logger.info "Processing #{input.size} units of awesomeness"
         | 
| 41 42 | 
             
              #   end
         | 
| 42 43 | 
             
              #
         | 
| @@ -66,7 +67,13 @@ module RightSupport::Log | |
| 66 67 | 
             
                # Class methods that become available to classes that include Mixin.
         | 
| 67 68 | 
             
                module ClassMethods
         | 
| 68 69 | 
             
                  def logger
         | 
| 69 | 
            -
                    @logger | 
| 70 | 
            +
                    if @logger
         | 
| 71 | 
            +
                      @logger
         | 
| 72 | 
            +
                    elsif superclass.respond_to?(:logger) && superclass.logger
         | 
| 73 | 
            +
                      superclass.logger
         | 
| 74 | 
            +
                    else
         | 
| 75 | 
            +
                      RightSupport::Log::Mixin.default_logger
         | 
| 76 | 
            +
                    end
         | 
| 70 77 | 
             
                  end
         | 
| 71 78 |  | 
| 72 79 | 
             
                  def logger=(logger)
         | 
| @@ -23,6 +23,7 @@ | |
| 23 23 | 
             
            require 'logger'
         | 
| 24 24 |  | 
| 25 25 | 
             
            module RightSupport::Rack
         | 
| 26 | 
            +
             | 
| 26 27 | 
             
              # A Rack middleware that logs information about every HTTP request received and
         | 
| 27 28 | 
             
              # every exception raised while processing a request.
         | 
| 28 29 | 
             
              #
         | 
| @@ -32,31 +33,36 @@ module RightSupport::Rack | |
| 32 33 | 
             
              # RequestLogger can be used standalone to fulfill all logging needs, or combined
         | 
| 33 34 | 
             
              # with Rack::Logger or another middleware that provides logging services.
         | 
| 34 35 | 
             
              class RequestLogger
         | 
| 36 | 
            +
             | 
| 35 37 | 
             
                # Initialize an instance of the middleware.
         | 
| 36 38 | 
             
                #
         | 
| 37 | 
            -
                #  | 
| 38 | 
            -
                # app(Object):: the inner application or middleware layer; must respond to #call
         | 
| 39 | 
            +
                # @param [Object] app inner application or middleware layer; must respond to #call
         | 
| 39 40 | 
             
                #
         | 
| 40 | 
            -
                 | 
| 41 | 
            +
                # @option options [Array] :only log for these path Regexps unless in debug mode
         | 
| 42 | 
            +
                # @option options [Array] :except log except for these path Regexps unless in debug mode
         | 
| 43 | 
            +
                def initialize(app, options = {})
         | 
| 41 44 | 
             
                  @app = app
         | 
| 45 | 
            +
                  @only = options[:only]
         | 
| 46 | 
            +
                  @except = options[:except]
         | 
| 42 47 | 
             
                end
         | 
| 43 48 |  | 
| 44 49 | 
             
                # Add a logger to the Rack environment and call the next middleware.
         | 
| 50 | 
            +
                # Set "rack.logging.enabled" in Rack environment to indicate whether logging
         | 
| 51 | 
            +
                # is enabled for this request for use by other middleware in the call chain.
         | 
| 45 52 | 
             
                #
         | 
| 46 | 
            -
                #  | 
| 47 | 
            -
                # env(Hash):: the Rack environment
         | 
| 53 | 
            +
                # @param [Hash] env Rack environment
         | 
| 48 54 | 
             
                #
         | 
| 49 | 
            -
                #  | 
| 50 | 
            -
                # always returns whatever value is returned by the next layer of middleware
         | 
| 55 | 
            +
                # @return [Object] always returns whatever value is returned by the next layer of middleware
         | 
| 51 56 | 
             
                def call(env)
         | 
| 52 57 | 
             
                  logger = env["rack.logger"]
         | 
| 58 | 
            +
                  env["rack.logging.enabled"] = enabled = logging_enabled?(logger, env)
         | 
| 53 59 |  | 
| 54 60 | 
             
                  began_at = Time.now
         | 
| 55 61 |  | 
| 56 | 
            -
                  log_request_begin(logger, env)
         | 
| 62 | 
            +
                  log_request_begin(logger, env) if enabled
         | 
| 57 63 | 
             
                  status, header, body = @app.call(env)
         | 
| 58 64 | 
             
                  log_exception(logger, env['sinatra.error']) if env['sinatra.error']
         | 
| 59 | 
            -
                  log_request_end(logger, status, header, began_at)
         | 
| 65 | 
            +
                  log_request_end(logger, status, header, began_at) if enabled
         | 
| 60 66 |  | 
| 61 67 | 
             
                  return [status, header, body]
         | 
| 62 68 | 
             
                rescue Exception => e
         | 
| @@ -66,14 +72,25 @@ module RightSupport::Rack | |
| 66 72 |  | 
| 67 73 | 
             
                private
         | 
| 68 74 |  | 
| 75 | 
            +
                # Determine whether logging enabled for given request
         | 
| 76 | 
            +
                #
         | 
| 77 | 
            +
                # @param [Object] logger for Rack
         | 
| 78 | 
            +
                # @param [Hash] env Rack environment
         | 
| 79 | 
            +
                #
         | 
| 80 | 
            +
                # @return [Boolean] enabled or not
         | 
| 81 | 
            +
                def logging_enabled?(logger, env)
         | 
| 82 | 
            +
                  path = env["PATH_INFO"]
         | 
| 83 | 
            +
                  env["HTTP_X_DEBUG"] || [Logger::DEBUG, :debug].include?(logger.level) ||
         | 
| 84 | 
            +
                      @only && @only.any? { |o| o.is_a?(Regexp) ? (path =~ o) : (path == o) } ||
         | 
| 85 | 
            +
                      @except && @except.none? { |e| e.is_a?(Regexp) ? (path =~ e) : (path == e) }
         | 
| 86 | 
            +
                end
         | 
| 87 | 
            +
             | 
| 69 88 | 
             
                # Log beginning of request
         | 
| 70 89 | 
             
                #
         | 
| 71 | 
            -
                #  | 
| 72 | 
            -
                #  | 
| 73 | 
            -
                # env(Hash):: the Rack environment
         | 
| 90 | 
            +
                # @param [Object] logger for Rack
         | 
| 91 | 
            +
                # @param [Hash] env Rack environment
         | 
| 74 92 | 
             
                #
         | 
| 75 | 
            -
                #  | 
| 76 | 
            -
                # always returns true
         | 
| 93 | 
            +
                # @return [TrueClass] always true
         | 
| 77 94 | 
             
                def log_request_begin(logger, env)
         | 
| 78 95 | 
             
                  # Assuming remote addresses are IPv4, make them all align to the same width
         | 
| 79 96 | 
             
                  remote_addr = env['HTTP_X_FORWARDED_FOR'] || env["REMOTE_ADDR"] || "-"
         | 
| @@ -114,14 +131,12 @@ module RightSupport::Rack | |
| 114 131 |  | 
| 115 132 | 
             
                # Log end of request
         | 
| 116 133 | 
             
                #
         | 
| 117 | 
            -
                #  | 
| 118 | 
            -
                #  | 
| 119 | 
            -
                #  | 
| 120 | 
            -
                #  | 
| 121 | 
            -
                # began_at(Time):: time of the Rack request begging
         | 
| 134 | 
            +
                # @param [Object] logger for Rack
         | 
| 135 | 
            +
                # @param [Hash] env Rack environment
         | 
| 136 | 
            +
                # @param [Fixnum] status of the Rack request
         | 
| 137 | 
            +
                # @param [Time] began_at time of the Rack request beginning
         | 
| 122 138 | 
             
                #
         | 
| 123 | 
            -
                #  | 
| 124 | 
            -
                # always returns true
         | 
| 139 | 
            +
                # @return [TrueClass] always true
         | 
| 125 140 | 
             
                def log_request_end(logger, status, headers, began_at)
         | 
| 126 141 | 
             
                  duration = (Time.now - began_at) * 1000
         | 
| 127 142 |  | 
| @@ -142,14 +157,12 @@ module RightSupport::Rack | |
| 142 157 |  | 
| 143 158 | 
             
                # Log exception
         | 
| 144 159 | 
             
                #
         | 
| 145 | 
            -
                #  | 
| 146 | 
            -
                #  | 
| 147 | 
            -
                # e(Exception):: Exception to be logged
         | 
| 160 | 
            +
                # @param [Object] logger for Rack
         | 
| 161 | 
            +
                # @param [Exception] exception to be logged
         | 
| 148 162 | 
             
                #
         | 
| 149 | 
            -
                #  | 
| 150 | 
            -
                 | 
| 151 | 
            -
             | 
| 152 | 
            -
                  msg = ["#{e.class} - #{e.message}", *e.backtrace].join("\n")
         | 
| 163 | 
            +
                # @return [TrueClass] always true
         | 
| 164 | 
            +
                def log_exception(logger, exception)
         | 
| 165 | 
            +
                  msg = ["#{exception.class} - #{exception.message}", *exception.backtrace].join("\n")
         | 
| 153 166 | 
             
                  logger.error(msg)
         | 
| 154 167 | 
             
                rescue
         | 
| 155 168 | 
             
                  #no-op, something is seriously messed up by this point...
         | 
    
        data/right_support.gemspec
    CHANGED
    
    | @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = "right_support"
         | 
| 8 | 
            -
              s.version = "2.8. | 
| 8 | 
            +
              s.version = "2.8.15"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Tony Spataro", "Sergey Sergyenko", "Ryan Williamson", "Lee Kirchhoff", "Alexey Karpik", "Scott Messier"]
         | 
| 12 | 
            -
              s.date = "2014- | 
| 12 | 
            +
              s.date = "2014-02-26"
         | 
| 13 13 | 
             
              s.description = "A toolkit of useful, reusable foundation code created by RightScale."
         | 
| 14 14 | 
             
              s.email = "support@rightscale.com"
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
| @@ -27,12 +27,10 @@ Gem::Specification.new do |s| | |
| 27 27 | 
             
                "VERSION",
         | 
| 28 28 | 
             
                "features/balancer_error_handling.feature",
         | 
| 29 29 | 
             
                "features/balancer_health_check.feature",
         | 
| 30 | 
            -
                "features/ | 
| 31 | 
            -
                "features/continuous_integration_cucumber.feature",
         | 
| 32 | 
            -
                "features/continuous_integration_rspec1.feature",
         | 
| 33 | 
            -
                "features/continuous_integration_rspec2.feature",
         | 
| 30 | 
            +
                "features/hash_tools.feature",
         | 
| 34 31 | 
             
                "features/http_client_timeout.feature",
         | 
| 35 32 | 
             
                "features/serialization.feature",
         | 
| 33 | 
            +
                "features/step_definitions/hash_tools_steps.rb",
         | 
| 36 34 | 
             
                "features/step_definitions/http_client_steps.rb",
         | 
| 37 35 | 
             
                "features/step_definitions/request_balancer_steps.rb",
         | 
| 38 36 | 
             
                "features/step_definitions/ruby_steps.rb",
         | 
| @@ -139,43 +137,28 @@ Gem::Specification.new do |s| | |
| 139 137 | 
             
              s.homepage = "https://github.com/rightscale/right_support"
         | 
| 140 138 | 
             
              s.licenses = ["MIT"]
         | 
| 141 139 | 
             
              s.require_paths = ["lib"]
         | 
| 142 | 
            -
              s.rubygems_version = "1.8. | 
| 140 | 
            +
              s.rubygems_version = "1.8.28"
         | 
| 143 141 | 
             
              s.summary = "Reusable foundation code."
         | 
| 144 142 |  | 
| 145 143 | 
             
              if s.respond_to? :specification_version then
         | 
| 146 144 | 
             
                s.specification_version = 3
         | 
| 147 145 |  | 
| 148 146 | 
             
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 149 | 
            -
                  s.add_development_dependency(%q< | 
| 150 | 
            -
                  s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
         | 
| 151 | 
            -
                  s.add_development_dependency(%q<right_develop>, ["~> 1.0"])
         | 
| 152 | 
            -
                  s.add_development_dependency(%q<ruby-debug>, [">= 0.10"])
         | 
| 153 | 
            -
                  s.add_development_dependency(%q<ruby-debug19>, [">= 0.11.6"])
         | 
| 154 | 
            -
                  s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
         | 
| 147 | 
            +
                  s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
         | 
| 155 148 | 
             
                  s.add_development_dependency(%q<flexmock>, ["~> 1.0"])
         | 
| 156 | 
            -
                  s.add_development_dependency(%q< | 
| 157 | 
            -
                  s.add_development_dependency(%q< | 
| 149 | 
            +
                  s.add_development_dependency(%q<rspec>, ["~> 2.13.0"])
         | 
| 150 | 
            +
                  s.add_development_dependency(%q<cucumber>, ["< 1.3.3", "~> 1.0"])
         | 
| 158 151 | 
             
                else
         | 
| 159 | 
            -
                  s.add_dependency(%q< | 
| 160 | 
            -
                  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
         | 
| 161 | 
            -
                  s.add_dependency(%q<right_develop>, ["~> 1.0"])
         | 
| 162 | 
            -
                  s.add_dependency(%q<ruby-debug>, [">= 0.10"])
         | 
| 163 | 
            -
                  s.add_dependency(%q<ruby-debug19>, [">= 0.11.6"])
         | 
| 164 | 
            -
                  s.add_dependency(%q<rdoc>, [">= 2.4.2"])
         | 
| 152 | 
            +
                  s.add_dependency(%q<jeweler>, ["~> 2.0"])
         | 
| 165 153 | 
             
                  s.add_dependency(%q<flexmock>, ["~> 1.0"])
         | 
| 166 | 
            -
                  s.add_dependency(%q< | 
| 167 | 
            -
                  s.add_dependency(%q< | 
| 154 | 
            +
                  s.add_dependency(%q<rspec>, ["~> 2.13.0"])
         | 
| 155 | 
            +
                  s.add_dependency(%q<cucumber>, ["< 1.3.3", "~> 1.0"])
         | 
| 168 156 | 
             
                end
         | 
| 169 157 | 
             
              else
         | 
| 170 | 
            -
                s.add_dependency(%q< | 
| 171 | 
            -
                s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
         | 
| 172 | 
            -
                s.add_dependency(%q<right_develop>, ["~> 1.0"])
         | 
| 173 | 
            -
                s.add_dependency(%q<ruby-debug>, [">= 0.10"])
         | 
| 174 | 
            -
                s.add_dependency(%q<ruby-debug19>, [">= 0.11.6"])
         | 
| 175 | 
            -
                s.add_dependency(%q<rdoc>, [">= 2.4.2"])
         | 
| 158 | 
            +
                s.add_dependency(%q<jeweler>, ["~> 2.0"])
         | 
| 176 159 | 
             
                s.add_dependency(%q<flexmock>, ["~> 1.0"])
         | 
| 177 | 
            -
                s.add_dependency(%q< | 
| 178 | 
            -
                s.add_dependency(%q< | 
| 160 | 
            +
                s.add_dependency(%q<rspec>, ["~> 2.13.0"])
         | 
| 161 | 
            +
                s.add_dependency(%q<cucumber>, ["< 1.3.3", "~> 1.0"])
         | 
| 179 162 | 
             
              end
         | 
| 180 163 | 
             
            end
         | 
| 181 164 |  | 
    
        data/right_support.rconf
    CHANGED
    
    
| @@ -65,7 +65,7 @@ describe RightSupport::DB::CassandraModel do | |
| 65 65 | 
             
                    begin
         | 
| 66 66 | 
             
                      ENV['RACK_ENV'] = env
         | 
| 67 67 |  | 
| 68 | 
            -
                      flexmock(Cassandra).should_receive(:new).with(/#{default_keyspace}_#{env}/, congig_test , {:timeout=> | 
| 68 | 
            +
                      flexmock(Cassandra).should_receive(:new).with(/#{default_keyspace}_#{env}/, congig_test , {:timeout=>20, :server_retry_period=>nil}).and_return(default_keyspace_connection)
         | 
| 69 69 | 
             
                      default_keyspace_connection.should_receive(:disable_node_auto_discovery!).and_return(true)
         | 
| 70 70 |  | 
| 71 71 |  | 
| @@ -43,8 +43,8 @@ describe RightSupport::DB::CassandraModel do | |
| 43 43 | 
             
                    default_keyspace_connection.should_receive(:disable_node_auto_discovery!).and_return(true)
         | 
| 44 44 | 
             
                    default_keyspace_connection.should_receive(:name).and_return('connection2')
         | 
| 45 45 |  | 
| 46 | 
            -
                    flexmock(Cassandra).should_receive(:new).with(keyspace + '_' + (ENV['RACK_ENV'] || 'development') + "_testns", "localhost:9160", {:timeout=> | 
| 47 | 
            -
                    flexmock(Cassandra).should_receive(:new).with(default_keyspace + '_' + (ENV['RACK_ENV'] || 'development') + "_testns", "localhost:9160", {:timeout=> | 
| 46 | 
            +
                    flexmock(Cassandra).should_receive(:new).with(keyspace + '_' + (ENV['RACK_ENV'] || 'development') + "_testns", "localhost:9160", {:timeout=>20, :server_retry_period=>nil}).and_return(current_keyspace_connection)
         | 
| 47 | 
            +
                    flexmock(Cassandra).should_receive(:new).with(default_keyspace + '_' + (ENV['RACK_ENV'] || 'development') + "_testns", "localhost:9160", {:timeout=>20, :server_retry_period=>nil}).and_return(default_keyspace_connection)
         | 
| 48 48 | 
             
                  end
         | 
| 49 49 |  | 
| 50 50 | 
             
                  it 'raises a meaningful exception when a config stanza is missing' do
         | 
    
        data/spec/log/mixin_spec.rb
    CHANGED
    
    | @@ -4,6 +4,9 @@ class InnocentVictim | |
| 4 4 | 
             
              include RightSupport::Log::Mixin
         | 
| 5 5 | 
             
            end
         | 
| 6 6 |  | 
| 7 | 
            +
            class Bystander < InnocentVictim
         | 
| 8 | 
            +
            end
         | 
| 9 | 
            +
             | 
| 7 10 | 
             
            describe RightSupport::Log::Mixin do
         | 
| 8 11 | 
             
              context 'when mixed into a base class' do
         | 
| 9 12 | 
             
                before(:each) do
         | 
| @@ -59,4 +62,30 @@ describe RightSupport::Log::Mixin do | |
| 59 62 | 
             
                  end
         | 
| 60 63 | 
             
                end
         | 
| 61 64 | 
             
              end
         | 
| 65 | 
            +
             | 
| 66 | 
            +
              context 'when inherited from a base class' do
         | 
| 67 | 
            +
                let(:base_logger) { flexmock('base-class logger') }
         | 
| 68 | 
            +
                let(:subclass_logger) { flexmock('derived-class logger') }
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                after(:each) do
         | 
| 71 | 
            +
                  InnocentVictim.logger = nil
         | 
| 72 | 
            +
                  Bystander.logger = nil
         | 
| 73 | 
            +
                end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                it 'delegates to base class' do
         | 
| 76 | 
            +
                  InnocentVictim.logger = base_logger
         | 
| 77 | 
            +
                  base_logger.should_receive(:error).with('foo').once
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                  Bystander.logger.error('foo')
         | 
| 80 | 
            +
                end
         | 
| 81 | 
            +
             | 
| 82 | 
            +
                it 'allows override in child class' do
         | 
| 83 | 
            +
                  InnocentVictim.logger = base_logger
         | 
| 84 | 
            +
                  Bystander.logger = subclass_logger
         | 
| 85 | 
            +
                  base_logger.should_receive(:error).never
         | 
| 86 | 
            +
                  subclass_logger.should_receive(:error).with('foo').once
         | 
| 87 | 
            +
             | 
| 88 | 
            +
                  Bystander.logger.error('foo')
         | 
| 89 | 
            +
                end
         | 
| 90 | 
            +
              end
         | 
| 62 91 | 
             
            end
         | 
| @@ -316,7 +316,6 @@ describe RightSupport::Net::RequestBalancer do | |
| 316 316 | 
             
                  it 're-raises reasonable default fatal errors' do
         | 
| 317 317 | 
             
                    test_raise(nil, ArgumentError, [ArgumentError, 1])
         | 
| 318 318 | 
             
                    test_raise(nil, MockResourceNotFound, [MockResourceNotFound, 1])
         | 
| 319 | 
            -
                    test_raise(nil, RSpec::Expectations::ExpectationNotMetError, [RSpec::Expectations::ExpectationNotMetError, 1])
         | 
| 320 319 | 
             
                  end
         | 
| 321 320 |  | 
| 322 321 | 
             
                  it 'swallows StandardError and friends' do
         | 
| @@ -47,6 +47,45 @@ describe RightSupport::Rack::RequestLogger do | |
| 47 47 | 
             
                  end
         | 
| 48 48 | 
             
                end
         | 
| 49 49 |  | 
| 50 | 
            +
                context 'when limit logging extent' do
         | 
| 51 | 
            +
                  before(:each) do
         | 
| 52 | 
            +
                    @options = {:except => [/bar/]}
         | 
| 53 | 
            +
                    @env.merge!('PATH_INFO' => '/foo/bar')
         | 
| 54 | 
            +
                    @middleware = RightSupport::Rack::RequestLogger.new(@app, @options)
         | 
| 55 | 
            +
                    @logger.should_receive(:level).and_return(Logger::INFO).by_default
         | 
| 56 | 
            +
                  end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                  it 'does not limit if logger in debug mode' do
         | 
| 59 | 
            +
                    @logger.should_receive(:level).and_return(Logger::DEBUG)
         | 
| 60 | 
            +
                    @logger.should_receive(:info)
         | 
| 61 | 
            +
                    @middleware.call(@env)
         | 
| 62 | 
            +
                  end
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                  it 'does not limit if HTTP_X_DEBUG set' do
         | 
| 65 | 
            +
                    @logger.should_receive(:info)
         | 
| 66 | 
            +
                    @middleware.call(@env.merge('HTTP_X_DEBUG' => true))
         | 
| 67 | 
            +
                  end
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                  it 'does not log for paths matching :except option' do
         | 
| 70 | 
            +
                    @logger.should_receive(:info).never
         | 
| 71 | 
            +
                    @middleware.call(@env)
         | 
| 72 | 
            +
                  end
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                  it 'does log for paths matching :only option' do
         | 
| 75 | 
            +
                    @options = {:only => [/bar/]}
         | 
| 76 | 
            +
                    @middleware = RightSupport::Rack::RequestLogger.new(@app, @options)
         | 
| 77 | 
            +
                    @logger.should_receive(:info)
         | 
| 78 | 
            +
                    @middleware.call(@env)
         | 
| 79 | 
            +
                  end
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                  it 'sets rack.logging.enabled in Rack environment' do
         | 
| 82 | 
            +
                    @logger.should_receive(:info)
         | 
| 83 | 
            +
                    @env.merge!('PATH_INFO' => '/my/app')
         | 
| 84 | 
            +
                    @middleware.call(@env)
         | 
| 85 | 
            +
                    @env['rack.logging.enabled'].should be_true
         | 
| 86 | 
            +
                  end
         | 
| 87 | 
            +
                end
         | 
| 88 | 
            +
             | 
| 50 89 | 
             
                context 'Shard ID logging' do
         | 
| 51 90 | 
             
                  before(:each) do
         | 
| 52 91 | 
             
                    @logger = mock_logger
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -22,9 +22,6 @@ | |
| 22 22 | 
             
            require 'rubygems'
         | 
| 23 23 | 
             
            require 'bundler/setup'
         | 
| 24 24 | 
             
            require 'flexmock'
         | 
| 25 | 
            -
            require 'ruby-debug'
         | 
| 26 | 
            -
            require 'syntax'
         | 
| 27 | 
            -
            require 'right_develop'
         | 
| 28 25 |  | 
| 29 26 | 
             
            $:.unshift(File.expand_path('../../../lib', __FILE__)) #ensure we load THIS project's code, not an installed gem
         | 
| 30 27 | 
             
            require 'right_support'
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: right_support
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 49
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 2
         | 
| 8 8 | 
             
              - 8
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 2.8. | 
| 9 | 
            +
              - 15
         | 
| 10 | 
            +
              version: 2.8.15
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Tony Spataro
         | 
| @@ -20,41 +20,27 @@ autorequire: | |
| 20 20 | 
             
            bindir: bin
         | 
| 21 21 | 
             
            cert_chain: []
         | 
| 22 22 |  | 
| 23 | 
            -
            date: 2014- | 
| 23 | 
            +
            date: 2014-02-27 00:00:00 -08:00
         | 
| 24 | 
            +
            default_executable: 
         | 
| 24 25 | 
             
            dependencies: 
         | 
| 25 26 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 27 | 
            +
              type: :development
         | 
| 26 28 | 
             
              version_requirements: &id001 !ruby/object:Gem::Requirement 
         | 
| 27 29 | 
             
                none: false
         | 
| 28 30 | 
             
                requirements: 
         | 
| 29 31 | 
             
                - - ~>
         | 
| 30 32 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 31 | 
            -
                    hash:  | 
| 33 | 
            +
                    hash: 3
         | 
| 32 34 | 
             
                    segments: 
         | 
| 35 | 
            +
                    - 2
         | 
| 33 36 | 
             
                    - 0
         | 
| 34 | 
            -
                     | 
| 35 | 
            -
                    version: "0.9"
         | 
| 36 | 
            -
              type: :development
         | 
| 37 | 
            -
              requirement: *id001
         | 
| 38 | 
            -
              prerelease: false
         | 
| 39 | 
            -
              name: rake
         | 
| 40 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 41 | 
            -
              version_requirements: &id002 !ruby/object:Gem::Requirement 
         | 
| 42 | 
            -
                none: false
         | 
| 43 | 
            -
                requirements: 
         | 
| 44 | 
            -
                - - ~>
         | 
| 45 | 
            -
                  - !ruby/object:Gem::Version 
         | 
| 46 | 
            -
                    hash: 49
         | 
| 47 | 
            -
                    segments: 
         | 
| 48 | 
            -
                    - 1
         | 
| 49 | 
            -
                    - 8
         | 
| 50 | 
            -
                    - 3
         | 
| 51 | 
            -
                    version: 1.8.3
         | 
| 52 | 
            -
              type: :development
         | 
| 53 | 
            -
              requirement: *id002
         | 
| 37 | 
            +
                    version: "2.0"
         | 
| 54 38 | 
             
              prerelease: false
         | 
| 39 | 
            +
              requirement: *id001
         | 
| 55 40 | 
             
              name: jeweler
         | 
| 56 41 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 57 | 
            -
               | 
| 42 | 
            +
              type: :development
         | 
| 43 | 
            +
              version_requirements: &id002 !ruby/object:Gem::Requirement 
         | 
| 58 44 | 
             
                none: false
         | 
| 59 45 | 
             
                requirements: 
         | 
| 60 46 | 
             
                - - ~>
         | 
| @@ -64,103 +50,48 @@ dependencies: | |
| 64 50 | 
             
                    - 1
         | 
| 65 51 | 
             
                    - 0
         | 
| 66 52 | 
             
                    version: "1.0"
         | 
| 67 | 
            -
              type: :development
         | 
| 68 | 
            -
              requirement: *id003
         | 
| 69 53 | 
             
              prerelease: false
         | 
| 70 | 
            -
               | 
| 54 | 
            +
              requirement: *id002
         | 
| 55 | 
            +
              name: flexmock
         | 
| 71 56 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 72 | 
            -
              version_requirements: &id004 !ruby/object:Gem::Requirement 
         | 
| 73 | 
            -
                none: false
         | 
| 74 | 
            -
                requirements: 
         | 
| 75 | 
            -
                - - ">="
         | 
| 76 | 
            -
                  - !ruby/object:Gem::Version 
         | 
| 77 | 
            -
                    hash: 31
         | 
| 78 | 
            -
                    segments: 
         | 
| 79 | 
            -
                    - 0
         | 
| 80 | 
            -
                    - 10
         | 
| 81 | 
            -
                    version: "0.10"
         | 
| 82 57 | 
             
              type: :development
         | 
| 83 | 
            -
               | 
| 84 | 
            -
              prerelease: false
         | 
| 85 | 
            -
              name: ruby-debug
         | 
| 86 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 87 | 
            -
              version_requirements: &id005 !ruby/object:Gem::Requirement 
         | 
| 58 | 
            +
              version_requirements: &id003 !ruby/object:Gem::Requirement 
         | 
| 88 59 | 
             
                none: false
         | 
| 89 60 | 
             
                requirements: 
         | 
| 90 | 
            -
                - -  | 
| 61 | 
            +
                - - ~>
         | 
| 91 62 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 92 | 
            -
                    hash:  | 
| 63 | 
            +
                    hash: 59
         | 
| 93 64 | 
             
                    segments: 
         | 
| 65 | 
            +
                    - 2
         | 
| 66 | 
            +
                    - 13
         | 
| 94 67 | 
             
                    - 0
         | 
| 95 | 
            -
                     | 
| 96 | 
            -
                    - 6
         | 
| 97 | 
            -
                    version: 0.11.6
         | 
| 98 | 
            -
              type: :development
         | 
| 99 | 
            -
              requirement: *id005
         | 
| 68 | 
            +
                    version: 2.13.0
         | 
| 100 69 | 
             
              prerelease: false
         | 
| 101 | 
            -
               | 
| 70 | 
            +
              requirement: *id003
         | 
| 71 | 
            +
              name: rspec
         | 
| 102 72 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 103 | 
            -
              version_requirements: &id006 !ruby/object:Gem::Requirement 
         | 
| 104 | 
            -
                none: false
         | 
| 105 | 
            -
                requirements: 
         | 
| 106 | 
            -
                - - ">="
         | 
| 107 | 
            -
                  - !ruby/object:Gem::Version 
         | 
| 108 | 
            -
                    hash: 27
         | 
| 109 | 
            -
                    segments: 
         | 
| 110 | 
            -
                    - 2
         | 
| 111 | 
            -
                    - 4
         | 
| 112 | 
            -
                    - 2
         | 
| 113 | 
            -
                    version: 2.4.2
         | 
| 114 73 | 
             
              type: :development
         | 
| 115 | 
            -
               | 
| 116 | 
            -
              prerelease: false
         | 
| 117 | 
            -
              name: rdoc
         | 
| 118 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 119 | 
            -
              version_requirements: &id007 !ruby/object:Gem::Requirement 
         | 
| 74 | 
            +
              version_requirements: &id004 !ruby/object:Gem::Requirement 
         | 
| 120 75 | 
             
                none: false
         | 
| 121 76 | 
             
                requirements: 
         | 
| 122 | 
            -
                - -  | 
| 77 | 
            +
                - - <
         | 
| 123 78 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 124 | 
            -
                    hash:  | 
| 79 | 
            +
                    hash: 29
         | 
| 125 80 | 
             
                    segments: 
         | 
| 126 81 | 
             
                    - 1
         | 
| 127 | 
            -
                    -  | 
| 128 | 
            -
                     | 
| 129 | 
            -
             | 
| 130 | 
            -
              requirement: *id007
         | 
| 131 | 
            -
              prerelease: false
         | 
| 132 | 
            -
              name: flexmock
         | 
| 133 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 134 | 
            -
              version_requirements: &id008 !ruby/object:Gem::Requirement 
         | 
| 135 | 
            -
                none: false
         | 
| 136 | 
            -
                requirements: 
         | 
| 82 | 
            +
                    - 3
         | 
| 83 | 
            +
                    - 3
         | 
| 84 | 
            +
                    version: 1.3.3
         | 
| 137 85 | 
             
                - - ~>
         | 
| 138 86 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 139 | 
            -
                    hash:  | 
| 87 | 
            +
                    hash: 15
         | 
| 140 88 | 
             
                    segments: 
         | 
| 141 89 | 
             
                    - 1
         | 
| 142 90 | 
             
                    - 0
         | 
| 143 | 
            -
                     | 
| 144 | 
            -
                    version: 1.0.0
         | 
| 145 | 
            -
              type: :development
         | 
| 146 | 
            -
              requirement: *id008
         | 
| 147 | 
            -
              prerelease: false
         | 
| 148 | 
            -
              name: syntax
         | 
| 149 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 150 | 
            -
              version_requirements: &id009 !ruby/object:Gem::Requirement 
         | 
| 151 | 
            -
                none: false
         | 
| 152 | 
            -
                requirements: 
         | 
| 153 | 
            -
                - - ~>
         | 
| 154 | 
            -
                  - !ruby/object:Gem::Version 
         | 
| 155 | 
            -
                    hash: 5
         | 
| 156 | 
            -
                    segments: 
         | 
| 157 | 
            -
                    - 1
         | 
| 158 | 
            -
                    - 5
         | 
| 159 | 
            -
                    version: "1.5"
         | 
| 160 | 
            -
              type: :development
         | 
| 161 | 
            -
              requirement: *id009
         | 
| 91 | 
            +
                    version: "1.0"
         | 
| 162 92 | 
             
              prerelease: false
         | 
| 163 | 
            -
               | 
| 93 | 
            +
              requirement: *id004
         | 
| 94 | 
            +
              name: cucumber
         | 
| 164 95 | 
             
            description: A toolkit of useful, reusable foundation code created by RightScale.
         | 
| 165 96 | 
             
            email: support@rightscale.com
         | 
| 166 97 | 
             
            executables: []
         | 
| @@ -181,12 +112,10 @@ files: | |
| 181 112 | 
             
            - VERSION
         | 
| 182 113 | 
             
            - features/balancer_error_handling.feature
         | 
| 183 114 | 
             
            - features/balancer_health_check.feature
         | 
| 184 | 
            -
            - features/ | 
| 185 | 
            -
            - features/continuous_integration_cucumber.feature
         | 
| 186 | 
            -
            - features/continuous_integration_rspec1.feature
         | 
| 187 | 
            -
            - features/continuous_integration_rspec2.feature
         | 
| 115 | 
            +
            - features/hash_tools.feature
         | 
| 188 116 | 
             
            - features/http_client_timeout.feature
         | 
| 189 117 | 
             
            - features/serialization.feature
         | 
| 118 | 
            +
            - features/step_definitions/hash_tools_steps.rb
         | 
| 190 119 | 
             
            - features/step_definitions/http_client_steps.rb
         | 
| 191 120 | 
             
            - features/step_definitions/request_balancer_steps.rb
         | 
| 192 121 | 
             
            - features/step_definitions/ruby_steps.rb
         | 
| @@ -289,6 +218,7 @@ files: | |
| 289 218 | 
             
            - spec/stats/helpers_spec.rb
         | 
| 290 219 | 
             
            - spec/validation/openssl_spec.rb
         | 
| 291 220 | 
             
            - spec/validation/ssh_spec.rb
         | 
| 221 | 
            +
            has_rdoc: true
         | 
| 292 222 | 
             
            homepage: https://github.com/rightscale/right_support
         | 
| 293 223 | 
             
            licenses: 
         | 
| 294 224 | 
             
            - MIT
         | 
| @@ -318,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 318 248 | 
             
            requirements: []
         | 
| 319 249 |  | 
| 320 250 | 
             
            rubyforge_project: 
         | 
| 321 | 
            -
            rubygems_version: 1. | 
| 251 | 
            +
            rubygems_version: 1.6.2
         | 
| 322 252 | 
             
            signing_key: 
         | 
| 323 253 | 
             
            specification_version: 3
         | 
| 324 254 | 
             
            summary: Reusable foundation code.
         |