Sha256: c649a1ad607856b62398441cf1c93b1f7d9ecfa183d3c1a4597fcd8201590df9

Contents?: true

Size: 1.64 KB

Versions: 10

Compression:

Stored size: 1.64 KB

Contents

require 'spec_helper'

describe name_from_filename do
    include_examples 'plugin'

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

    before :each do
        framework.plugins.load name_from_filename
        framework.plugins.run
    end

    after :each do
        framework.clean_up
    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_request_concurrency)' do
                    http.max_concurrency.times { http.get( url + 'slow' ) }
                    http.run
                    http.max_concurrency.should < options.http.request_concurrency

                    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.request_concurrency
                end
            end
        end
    end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
arachni-1.2.1 spec/components/plugins/autothrottle_spec.rb
arachni-1.2 spec/components/plugins/autothrottle_spec.rb
arachni-1.1 spec/components/plugins/autothrottle_spec.rb
arachni-1.0.6 spec/components/plugins/autothrottle_spec.rb
arachni-1.0.5 spec/components/plugins/autothrottle_spec.rb
arachni-1.0.4 spec/components/plugins/autothrottle_spec.rb
arachni-1.0.3 spec/components/plugins/autothrottle_spec.rb
arachni-1.0.2 spec/components/plugins/autothrottle_spec.rb
arachni-1.0.1 spec/components/plugins/autothrottle_spec.rb
arachni-1.0 spec/components/plugins/autothrottle_spec.rb