Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Slow tests #426

Closed
SamSaffron opened this Issue Sep 5, 2012 · 2 comments

Comments

Projects
None yet
2 participants
Contributor

SamSaffron commented Sep 5, 2012

I noticed all the rack tests are pretty fast except for:

  should 'not rechallenge if nonce is not stale' do
    begin
      Rack::Auth::Digest::Nonce.time_limit = 10

      request_with_digest_auth 'GET', '/', 'Alice', 'correct-password', :wait => 1 do |response|
        response.status.should.equal 200
        response.body.to_s.should.equal 'Hi Alice'
        response.headers['WWW-Authenticate'].should.not =~ /\bstale=true\b/
      end
    ensure
      Rack::Auth::Digest::Nonce.time_limit = nil
    end
  end

  should 'rechallenge with stale parameter if nonce is stale' do
    begin
      Rack::Auth::Digest::Nonce.time_limit = 1

      request_with_digest_auth 'GET', '/', 'Alice', 'correct-password', :wait => 2 do |response|
        assert_digest_auth_challenge response
        response.headers['WWW-Authenticate'].should =~ /\bstale=true\b/
      end
    ensure
      Rack::Auth::Digest::Nonce.time_limit = nil
    end
  end

They take 1 and 2 seconds respectively, should anything be done here to speed it up?

Owner

raggi commented Sep 5, 2012

not a high priority right now

Owner

raggi commented Nov 2, 2012

Suite runs in 1.36s here, I'm closing this for now. If I start being concerned about test performance I'll certainly bench the tests and probably target anything like this.

@raggi raggi closed this Nov 2, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment