Sha256: 2e2de8cd6ed1cdd7cc5bdc15e24dfaa4a7886f0f88f436f97eb40aeadb9c94e3

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

require_relative '../spec_helper'

describe name_from_filename do
    include_examples 'plugin'

    before( :all ) { run }

    def url
        @url ||= 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

1 entries across 1 versions & 1 rubygems

Version Path
arachni-0.4.2 spec/plugins/autothrottle_spec.rb