1 # -*- encoding: binary -*-
2 require './test/integration'
5 class TestMogileFSLargePipe< TestMogIntegration
8 @client = MogileFS::MogileFS.new(:hosts => @trackers, :domain => @domain)
11 def test_large_pipe_test
12 junk = File.open("/dev/urandom") { |fp| fp.read(1024) }
16 sha1 = Digest::SHA1.new
24 assert_equal(nr * junk.size, @client.store_file("a", nil, r))
27 @client.get_file_data("a") do |rd|
28 assert_equal(nr * junk.size, @client.store_file("b", nil, rd))
30 a = Thread.new { @client.get_file_data("a") { |rd| sha1read(rd) } }
31 b = Thread.new { @client.get_file_data("b") { |rd| sha1read(rd) } }
37 # We should be able to open FIFOs
41 x!("mkfifo", tmp_path)
43 File.open(tmp_path, "wb") do |wr|
44 nr.times { wr.write(junk) }
47 assert_equal(nr * junk.size, @client.store_file("fifo", nil, tmp_path))
48 _, status = Process.waitpid2(pid)
49 assert status.success?, status.inspect
50 fifo_sha1 = @client.get_file_data("fifo") { |rd| sha1read(rd) }
51 assert_equal sha1, fifo_sha1
57 while rd.read(16384, buf)