diff options
author | Eric Wong <e@80x24.org> | 2015-04-24 02:38:15 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-04-24 02:50:30 +0000 |
commit | 1964db56aa6fb7d57fc49cda10714d34c087a398 (patch) | |
tree | 15eaf3bd6b6ee9a0eb721697ad95e2285d9df67c /test/unit | |
parent | 544167c5c3aec5993928634c084ae9dd8650be38 (diff) | |
download | unicorn-1964db56aa6fb7d57fc49cda10714d34c087a398.tar.gz |
Rack::TempfileReaper was added in rack 1.6 to cleanup temporary files. Make Unicorn::TmpIO ducktype-compatible so Rack::TempfileReaper may be used to free up space used by temporary buffer files. Ref: <CY1PR0301MB078011EB5A22B733EB222A45A4EE0@CY1PR0301MB0780.namprd03.prod.outlook.com> Reported-by: Mike Mulvaney <MMulvaney@bna.com>
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/test_tee_input.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/unit/test_tee_input.rb b/test/unit/test_tee_input.rb index 0c2c941..4647e66 100644 --- a/test/unit/test_tee_input.rb +++ b/test/unit/test_tee_input.rb @@ -29,6 +29,13 @@ class TestTeeInput < Test::Unit::TestCase end while true end + def check_tempfiles + tmp = @parser.env["rack.tempfiles"] + assert_instance_of Array, tmp + assert_operator tmp.size, :>=, 1 + assert_instance_of Unicorn::TmpIO, tmp[0] + end + def test_gets_long r = init_request("hello", 5 + (4096 * 4 * 3) + "#$/foo#$/".size) ti = TeeInput.new(@rd, r) @@ -106,6 +113,7 @@ class TestTeeInput < Test::Unit::TestCase assert_kind_of File, ti.tmp assert_equal 0, ti.tmp.pos assert_equal Unicorn::Const::MAX_BODY + 1, ti.size + check_tempfiles end def test_read_in_full_if_content_length @@ -148,6 +156,7 @@ class TestTeeInput < Test::Unit::TestCase assert_nil ti.read(1) pid, status = Process.waitpid2(pid) assert status.success? + check_tempfiles end def test_chunked @@ -183,6 +192,7 @@ class TestTeeInput < Test::Unit::TestCase status = nil pid, status = Process.waitpid2(pid) assert status.success? + check_tempfiles end def test_chunked_ping_pong |