Sha256: dd1dfa0ae8eeff981d16a4a894383f8ebb0f4073c006140cbdef00704cabd9a7

Contents?: true

Size: 1.3 KB

Versions: 9

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'

describe name_from_filename do
    include_examples 'plugin'

    before( :all ) { run }

    def url
        @url ||= web_server_url_for( name_from_filename ) + '/'
    end

    context 'when the server response times are' do
        context "bellow threshold" do
            it 'does not touch the max concurrency' do
                pre = http.max_concurrency

                http.max_concurrency.times { http.get( url ) }
                http.run

                http.max_concurrency.should == pre
            end
        end
        context "above threshold" do
            it 'reduces the max concurrency' do
                pre = http.max_concurrency

                http.max_concurrency.times { http.get( url + 'slow' ) }
                http.run

                http.max_concurrency.should < pre
            end
            context "and then fall bellow threshold" do
                it 'increases the max concurrency (without exceeding http_req_limit)' do
                    pre = http.max_concurrency

                    (10 * http.max_concurrency).times { http.get( url ) }
                    http.run

                    http.max_concurrency.should > pre
                    http.max_concurrency.should <= options.http_req_limit
                end
            end
        end
    end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
arachni-0.4.7 spec/plugins/autothrottle_spec.rb
arachni-0.4.6 spec/plugins/autothrottle_spec.rb
arachni-0.4.5.2 spec/plugins/autothrottle_spec.rb
arachni-0.4.5.1 spec/plugins/autothrottle_spec.rb
arachni-0.4.5 spec/plugins/autothrottle_spec.rb
arachni-0.4.4 spec/plugins/autothrottle_spec.rb
arachni-0.4.3.2 spec/plugins/autothrottle_spec.rb
arachni-0.4.3.1 spec/plugins/autothrottle_spec.rb
arachni-0.4.3 spec/plugins/autothrottle_spec.rb