From eb34caa3f4b8cedddb14b9e4e0415e2258802134 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 1 Apr 2009 21:46:05 -0700 Subject: test_upload: fix a race condition in unlink test We need to ensure the next request has started processing before we can guarantee a temp file has been unlinked. --- test/unit/test_upload.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/unit/test_upload.rb b/test/unit/test_upload.rb index 8246f65..58058f1 100644 --- a/test/unit/test_upload.rb +++ b/test/unit/test_upload.rb @@ -74,6 +74,12 @@ class UploadTest < Test::Unit::TestCase sock.close assert path != path2 + # make sure the next request comes in so the unlink got processed + sock = TCPSocket.new(@addr, @port) + sock.syswrite("GET ?lasdf\r\n\r\n\r\n\r\n") + sock.sysread(4096) rescue nil + sock.close + assert ! File.exist?(path) end -- cgit v1.2.3-24-ge0c7