about summary refs log tree commit homepage
path: root/test/test_backend.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_backend.rb')
-rw-r--r--test/test_backend.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/test/test_backend.rb b/test/test_backend.rb
index 2078e9b..4d41354 100644
--- a/test/test_backend.rb
+++ b/test/test_backend.rb
@@ -25,12 +25,14 @@ class TestBackend < Test::Unit::TestCase
 
     assert_equal ['localhost:1'], @backend.hosts
     assert_equal 3, @backend.timeout
+    assert_equal 3, @backend.instance_variable_get(:@connect_timeout)
     assert_equal nil, @backend.lasterr
     assert_equal nil, @backend.lasterrstr
     assert_equal({}, @backend.dead)
 
     @backend = MogileFS::Backend.new :hosts => ['localhost:6001'], :timeout => 1
     assert_equal 1, @backend.timeout
+    assert_equal 1, @backend.instance_variable_get(:@connect_timeout)
   end
 
   def test_do_request
@@ -223,5 +225,18 @@ class TestBackend < Test::Unit::TestCase
     c = MogileFS::MogileFS.new(o)
     assert_equal 0.666, c.backend.instance_variable_get(:@fail_timeout)
   end
-end
 
+  def test_connect_timeout
+    o = {
+      :domain => "none",
+      :hosts => %w(0:666 0:6 0:66),
+      :connect_timeout => 1
+    }
+    c = MogileFS::MogileFS.new(o)
+    assert_equal 1, c.backend.instance_variable_get(:@connect_timeout)
+    o[:timeout] = 5
+    c = MogileFS::MogileFS.new(o)
+    assert_equal 1, c.backend.instance_variable_get(:@connect_timeout)
+    assert_equal 5, c.backend.instance_variable_get(:@timeout)
+  end
+end