summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-05-10 21:40:52 -0700
committerEric Wong <normalperson@yhbt.net>2009-05-10 21:44:25 -0700
commitb51edf0e5c563d73f09fd67016014dcfc7e7499a (patch)
treeaae36c690ffa848f52e42e03f95ff7be4eb3ed00
parent6c8a3d3c55997978bacaecc5dbbb7d03c2fee345 (diff)
This is a very important test for web servers designed to serve
slow clients, but Unicorn is not that.
-rw-r--r--test/tools/trickletest.rb45
1 files changed, 0 insertions, 45 deletions
diff --git a/test/tools/trickletest.rb b/test/tools/trickletest.rb
deleted file mode 100644
index e19ed71..0000000
--- a/test/tools/trickletest.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-require 'socket'
-require 'stringio'
-
-def do_test(st, chunk)
-  s = TCPSocket.new('127.0.0.1',ARGV[0].to_i);
-  req = StringIO.new(st)
-  nout = 0
-  randstop = rand(st.length / 10)
-  STDERR.puts "stopping after: #{randstop}"
-
-  begin
-    while data = req.read(chunk)
-      nout += s.write(data)
-      s.flush
-      sleep 0.1
-      if nout > randstop
-        STDERR.puts "BANG! after #{nout} bytes."
-        break
-      end
-    end
-  rescue Object => e
-    STDERR.puts "ERROR: #{e}"
-  ensure
-    s.close
-  end
-end
-
-content = "-" * (1024 * 240)
-st = "GET / HTTP/1.1\r\nHost: www.zedshaw.com\r\nContent-Type: text/plain\r\nContent-Length: #{content.length}\r\n\r\n#{content}"
-
-puts "length: #{content.length}"
-
-threads = []
-ARGV[1].to_i.times do
-  t = Thread.new do
-    size = 100
-    puts ">>>> #{size} sized chunks"
-    do_test(st, size)
-  end
-
-  t.abort_on_exception = true
-  threads << t
-end
-
-threads.each {|t|  t.join}