about summary refs log tree commit homepage
path: root/test/unit/test_server.rb
DateCommit message (Collapse)
2009-06-29"Fix" tests that break with stream_input=false
2009-06-10Optimize body-less GET/HEAD requests (again)
No point in making syscalls to deal with empty bodies. Reinstate usage of the NULL_IO object which allows us to avoid allocating new objects.
2009-04-10close listeners when removing them from our array
This fixes a long-standing bug where listeners would be removed from the known listener set during a reload but never correctly shut down (until reexec). Additionally, test_server was working around this bug (my fault, subconciously) as teardown did not unbind the socket, requiring the tests to grab a new port.
2009-04-05Add test for :preload_app config option
2009-03-27Always try to send a valid HTTP response back
This reworks error handling throughout the entire stack to be more Ruby-ish. Exceptions are raised instead of forcing the us to check return values. If a client is sending us a bad request, we send a 400. If unicorn or app breaks in an unexpected way, we'll send a 500. Both of these last-resort error responses are sent using IO#write_nonblock to avoid tying Unicorn up longer than necessary and all exceptions raised are ignored. Sending a valid HTTP response back should reduce the chance of us from being marked as down or broken by a load balancer. Previously, some load balancers would mark us as down if we close a socket without sending back a valid response; so make a best effort to send one. If for some reason we cannot write a valid response, we're still susceptible to being marked as down. A successful HttpResponse.write() call will now close the socket immediately (instead of doing it higher up the stack). This ensures the errors will never get written to the socket on a successful response.
2009-03-27test_server: quieter tests
2009-02-13tests: replace process_based_port with unused_port
unused_port is more reliable as it actually tries to bind a port and retries if it fails. This is also safe across parallel unicorn tests running in different directories.
2009-02-09Remove hard dependency on Rack
While we'll support anything that exposes a Rack-like interface (a very good one IMHO), we shouldn't have a hard dependency on Rack to simplify testing. While we're at it, I'm not using Daemons anymore, either, since that does too many things behind our back as far as daemonization goes. As a result of not depending on Rubygems, either, I've sped up my "make -j" test ~1.5 seconds
2009-02-09Support multiple listeners per-process
Use select(2) to multiplex non-blocking accept(2) calls between them. Additionally, aggressively make a bet after accepting clients where we'll try to do a non-blocking accept(2) against the full set of descriptors. This is based on the assumption that if we just accepted connections, we're probably reasonably busy. This should lead to lower latency under high load; but some wasted cycles when requests come in intermitently. By this same logic, we don't really care for the thundering herd problem, either; since it is only noticeable with many (hundreds) of processes when most of them are idle.
2009-02-09Remove threading and use worker processes instead
All tests for threading and semaphores have been removed. One test was changed because it depended on a shared variable. Tests will be replaced with tests to do process management instead.
2009-02-09s/Mongrel/Unicorn/g
Avoid conflicting with existing Mongrel libraries since we'll be incompatible and break things w/o disrupting Mongrel installations.
2009-01-31Mongrel.run(app, opts)
2009-01-31Started in test_server
2009-01-31Rename.