test/functional/timeout_test.rb in mongo-1.9.2 vs test/functional/timeout_test.rb in mongo-1.10.0.rc0

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (C) 2013 10gen Inc. +# Copyright (C) 2009-2013 MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # @@ -12,11 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. require 'test_helper' -class TestTimeout < Test::Unit::TestCase +class TimeoutTest < Test::Unit::TestCase + def test_op_timeout connection = standard_connection(:op_timeout => 0.5) admin = connection.db('admin') @@ -30,13 +31,13 @@ admin.command(command) end end def test_external_timeout_does_not_leave_socket_in_bad_state - client = Mongo::MongoClient.new - db = client[MONGO_TEST_DB] - coll = db['timeout-tests'] + client = standard_connection + db = client[TEST_DB] + coll = db['timeout-tests'] # prepare the database coll.drop coll.insert({:a => 1}) @@ -52,23 +53,6 @@ assert_nothing_raised do coll.find_one 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