diff options
Diffstat (limited to 'test/test_mogilefs.rb')
-rw-r--r-- | test/test_mogilefs.rb | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/test/test_mogilefs.rb b/test/test_mogilefs.rb index a8ec7b5..6e9ec7f 100644 --- a/test/test_mogilefs.rb +++ b/test/test_mogilefs.rb @@ -208,40 +208,6 @@ class TestMogileFS__MogileFS < TestMogileFS assert_equal 'new_key_2', next_after end - def test_list_keys_block - @backend.list_keys = { 'key_count' => '2', 'next_after' => 'new_key_2', - 'key_1' => 'new_key_1', 'key_2' => 'new_key_2' } - http_resp = "HTTP/1.0 200 OK\r\nContent-Length: %u\r\n" - srv = Proc.new do |serv, port, size| - client, _ = serv.accept - client.sync = true - readed = client.readpartial(4096) - assert %r{\AHEAD } =~ readed - client.send(http_resp % size, 0) - client.close - end - t1 = TempServer.new(Proc.new { |serv, port| srv.call(serv, port, 5) }) - t2 = TempServer.new(Proc.new { |serv, port| srv.call(serv, port, 5) }) - t3 = TempServer.new(Proc.new { |serv, port| srv.call(serv, port, 10) }) - @backend.get_paths = { 'paths' => '2', - 'path1' => "http://127.0.0.1:#{t1.port}/", - 'path2' => "http://127.0.0.1:#{t2.port}/" } - @backend.get_paths = { 'paths' => '1', - 'path1' => "http://127.0.0.1:#{t3.port}/" } - - res = [] - keys, next_after = @client.list_keys('new') do |key,length,devcount| - res << [ key, length, devcount ] - end - - expect_res = [ [ 'new_key_1', 5, 2 ], [ 'new_key_2', 10, 1 ] ] - assert_equal expect_res, res - assert_equal ['new_key_1', 'new_key_2'], keys.sort - assert_equal 'new_key_2', next_after - ensure - TempServer.destroy_all! - end - def test_new_file_http @client.readonly = true assert_raises MogileFS::ReadOnlyError do @@ -256,44 +222,6 @@ class TestMogileFS__MogileFS < TestMogileFS end end - def test_size_http - accept = Tempfile.new('accept') - t = TempServer.new(Proc.new do |serv,port| - client, _ = serv.accept - client.sync = true - readed = client.recv(4096, 0) rescue nil - accept.syswrite('.') - assert_equal "HEAD /path HTTP/1.0\r\n\r\n", readed - client.send("HTTP/1.0 200 OK\r\nContent-Length: 5\r\n\r\n", 0) - client.close - end) - - path = "http://127.0.0.1:#{t.port}/path" - @backend.get_paths = { 'paths' => 1, 'path1' => path } - - assert_equal 5, @client.size('key') - assert_equal 1, accept.stat.size - end - - def test_bad_size_http - tmp = Tempfile.new('accept') - t = TempServer.new(Proc.new do |serv,port| - client, _ = serv.accept - client.sync = true - readed = client.recv(4096, 0) rescue nil - assert_equal "HEAD /path HTTP/1.0\r\n\r\n", readed - tmp.syswrite('.') - client.send("HTTP/1.0 404 Not Found\r\nContent-Length: 5\r\n\r\n", 0) - client.close - end) - - path = "http://127.0.0.1:#{t.port}/path" - @backend.get_paths = { 'paths' => 1, 'path1' => path } - - assert_raises(MogileFS::Error) { @client.size('key') } - assert_equal 1, tmp.stat.size - end - def test_store_file_small_http received = Tempfile.new('received') to_store = Tempfile.new('small') |