Sha256: 90e7a08afdc1d463aadd99b87d56e6239bc99c0df21b697bb03d1188b842f49d

Contents?: true

Size: 931 Bytes

Versions: 47

Compression:

Stored size: 931 Bytes

Contents

require './test/test_helper'

class TestTimeout < Test::Unit::TestCase
  def test_op_timeout
    connection = standard_connection(:op_timeout => 2)
    
    admin = connection.db('admin')

    command = BSON::OrderedHash.new
    command[:sleep] = 1
    command[:secs] = 1
    # Should not timeout
    assert admin.command(command)
   
    # Should timeout
    command[:secs] = 3
    assert_raise Mongo::OperationTimeout do
      admin.command(command) 
    end

  end
=begin
  def test_ssl_op_timeout
    connection = standard_connection(:op_timeout => 1, :ssl => true)
    
    coll = connection.db(MONGO_TEST_DB).collection("test")
    coll.insert({:a => 1})
   
    # Should not timeout
    assert coll.find_one({"$where" => "sleep(100); return true;"})

    # Should timeout 
    assert_raise Mongo::OperationTimeout do
      coll.find_one({"$where" => "sleep(5 * 1000); return true;"})
    end

    coll.remove
  end
=end
end

Version data entries

47 entries across 47 versions & 2 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.7.4 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.7.3 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.7.2 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.7.1 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.7.0 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.6.9 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.6.8 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.6.7 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.6.6 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.6.5 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.6.4 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.6.3 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.6.2 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.6.1 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.6.0 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.5.17 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.5.16 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.5.15 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb
classiccms-0.5.14 vendor/bundle/gems/mongo-1.6.2/test/timeout_test.rb