diff options
author | Eric Wong <normalperson@yhbt.net> | 2012-03-08 09:57:42 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2012-03-08 10:19:59 +0000 |
commit | ff8c72fe8728be8da1ea0728484724de7ab0bb57 (patch) | |
tree | 22106659f489d8a18d9d703600f8528ddcfa5264 /test/http_chunked_put.rb | |
parent | e6ff08b223834ad10b8592550041275fdecaab6a (diff) | |
download | cmogstored-ff8c72fe8728be8da1ea0728484724de7ab0bb57.tar.gz |
In all cases except requests with Content-Range, a temporary file may be used to make PUT requests atomic. This prevents partial .fid files from appearing and potentially confusing fsck after server crashes. This also prevents MD5-verified requests from clobbering existing files and also from wasting disk space.
Diffstat (limited to 'test/http_chunked_put.rb')
-rw-r--r-- | test/http_chunked_put.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/http_chunked_put.rb b/test/http_chunked_put.rb index 56e8417..e3191dd 100644 --- a/test/http_chunked_put.rb +++ b/test/http_chunked_put.rb @@ -366,7 +366,7 @@ class TestHTTPChunkedPut < Test::Unit::TestCase @client.write(req) resp = @client.read assert_match(%r{\AHTTP/1\.1 400 Bad Request\r\n}, resp) - assert_equal 0, File.stat("#@tmpdir/dev666/foo").size + assert ! File.exist?("#@tmpdir/dev666/foo") end def test_content_md5_good @@ -381,6 +381,7 @@ class TestHTTPChunkedPut < Test::Unit::TestCase @client.write(req) line = @client.gets assert_match(%r{\AHTTP/1\.1 201 Created}, line) + assert_equal "abcde", File.read("#@tmpdir/dev666/foo") end def test_content_md5_bad @@ -395,5 +396,6 @@ class TestHTTPChunkedPut < Test::Unit::TestCase @client.write(req) line = @client.gets assert_match(%r{\AHTTP/1\.1 400 Bad Request}, line) + assert ! File.exist?("#@tmpdir/dev666/foo") end end |