about summary refs log tree commit homepage
path: root/test
DateCommit message (Collapse)
2009-03-25Ensure Tempfiles are unlinked after every request
Otherwise we bloat TMPDIR and run the host out of space, oops!
2009-03-21Handle Rack multivalue headers correctly
Rack uses a single newline character to represent multi-value headers. Thus { 'Set-Cookie' => "foo=bar\nbar=foo" } will get you: Set-Cookie: foo=bar Set-Cookie: bar=foo While RFC2616 says you can combine headers as: Set-Cookie: foo=bar,bar=foo There are probably HTTP clients out there that don't handle things correctly so don't bother... Additionally, don't bother doing duplicate suppression anymore. Just assume Rack or a higher layer knows what it's doing regarding duplicates and we'll get a Hash most of the time anyways.
2009-03-21Rotate master logs before workers.
The master _may_ run with different user/group/umask than the workers. Since the logs were always created by the master process, the master should rotate them first to ensure correct ownership and permissions. This way if the workers fail log rotation and die, they'll be automatically respawned with the new logs in place.
2009-03-21HttpRequest test so our requests pass Rack::Lint
This test requires Rack to be loaded and will not run without it. This also seems broken on 1.9 still with Rack 0.9.1...
2009-03-21unicorn/http11: remove GATEWAY_INTERFACE
It's a CGI-ism and is not in the Rack spec, so don't bother.
2009-03-18Add signal queueing for test reliability
Although I didn't like the idea initially, signal queueing allows test_exec to run more reliably and the limited signal queue size will prevent scary queued signal behavior. Also, always wakeup the master immediately when CHLD is trapped to reduce the performance impact of SIGHUP-based config reloading. Combined with an extra check in test_exec, this should make test_exec run much more reliably than before.
2009-03-18tests: do not trust (our correct use of) 1.9 encodings
Despite reading numerous articles and inspecting the 1.9.1-p0 C source, I will never trust that we're always handling encoding-aware IO objects correctly. Thus this new test uses UNIX shell utilities that should always operate on files/sockets on a byte-level. Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-03-09test_exec: increase backlog to 128
Hopefully this increases test reliability
2009-03-09Revert "Remove -P/--pid switch from CLI"
This reverts commit 4414d9bf34f162a604d2aacc765ab1ca2fc90404.
2009-03-09Revert "exec: disable embedded switch parsing in config.ru"
This reverts commit e66ab79b8b5bc5311c750bf03868a7b2574f4ea1. Conflicts: bin/unicorn
2009-03-03test_exec: remove extraneous fcntl require
There used to be a log rotation lambda in there, but that got moved to lib/unicorn/util.rb for convenience.
2009-03-03Add configurator test
2009-03-03Make USR1 rotate log files by default
I consider it a sensible default for long-running servers. Additionally, there is no easy way to make USR1 rotate the master process log without this.
2009-03-03Add Unicorn::Util for a reopen_logs method
Since I use it myself and also in the tests, we might as well implement it correctly as a class method so people can run it in their trap('USR2') hooks.
2009-03-03test_exec: avoid mis-teardown just in case...
Probably not a real bug, but test_exec has been experiencing mysterious failures....
2009-03-03test_exec: avoid hiding error when binary can't be found
Oops, that was making debugging tests quite difficult.
2009-03-03Remove -P/--pid switch from CLI
It's confusing with the lowercase "-p" option which is more common for developers to use. PID files are only needed for production deployments, and those should be using config files anyways.
2009-03-03test_exec: higher timeouts for log reading
Yeah, some of my test machines are ridiculously slow...
2009-03-03test_exec: be more liberal regarding terminal output
23x79 looks better in a terminal, but the Ruby 1.9 OptionParser output adds a little more whitespace requiring 24x80 output, which is still fine...
2009-03-03test/exec: avoid letting child processes unlink tempfiles
Hopefully this fixes some random test failures I've been experiencing...
2009-03-03test for "unicorn --help" output
Ensure the output fits in a standard ANSI terminal so it's easy to read for all users regardless of what interface they're working from.
2009-03-03exec: disable embedded switch parsing in config.ru
Since not all rackup command-line options can be supported by Unicorn, disable this gross hack to avoid potentially unpredictable or undefined behavior. config.ru will not be able to specify the config file for unicorn-specific options; but the unicorn-specific config files themselves will be allowed to override the default config.ru location.
2009-03-03test_exec: simplify check for unicorn binary
2009-03-03test/aggregate: remove Ruby version from output
This was accidentally left in there during 1.9 compatibility testing.
2009-02-21Fix+test reexec error handling on bad inputs
People can screw config files up, it's not my fault if they do, but they do... Don't let the original process get wedged if we can help it..
2009-02-21test_exec: fix for temporary files not being cleaned
Apparently the at_exit handlers were not triggering for an execed process.
2009-02-21GNUMakefile: revamp for parallel 1.8/1.9 runs
Add a install-test for doing a mock install with private http11 and bin/unicorn and appropriate PATH/RUBYLIB env. Also add a normal install target so we can just type "make install" and just be done with a regular installation (and it'll revert files if using git). I use the following local.mk to augment my GNUmakefile. It allows me to run "make -j full-test" and run both 1.8 and 1.9 tests in parallel. --------------------------- 8< ------------------------- DLEXT := so rack_ver := 0.9.1 ifeq ($(r19),) ruby := $(HOME)/bin/ruby RUBYLIB := $(HOME)/lib/ruby/gems/1.8/gems/rack-$(rack_ver)/lib else export PATH := $(HOME)/ruby-1.9/bin:$(PATH) ruby := $(HOME)/ruby-1.9/bin/ruby RUBYLIB := $(HOME)/ruby-1.9/lib/ruby/gems/1.9.1/gems/rack-$(rack_ver)/lib endif SHELL := /bin/bash -e -o pipefail full-test: test-18 test-19 test-18: $(MAKE) test 2>&1 | sed -u -e 's!^!1.8 !' test-19: $(MAKE) test r19=1 2>&1 | sed -u -e 's!^!1.9 !' --------------------------- 8< -------------------------
2009-02-21Replace unicorn binary with something rackup-like
This adds a bunch of execution tests that require the "unicorn" binary to be in PATH as well as rack being directly "require"-able ("rubygems" will not be loaded for you). The tester is responsible for setting up PATH and RUBYLIB appropriately.
2009-02-21test_helper: cleanup requires
We don't need these dependencies slowing down load times on our tests..
2009-02-20test_upload: trap EPIPE if a connection shuts us down, too
Reset connections can also return EPIPE under Linux, not just ECONNRESET; so be sure to trap that error, too.
2009-02-20test_upload: close urandom fd at teardown
Prevent the GC from trying to close it (and hitting the wrong descriptor) when @random is reopened for running tests.
2009-02-14HttpResponse: remove crack-addled HTTP_STATUS_HEADERS hash
This also fixes a subtle bug in header generation when the +$,+ ($OFS) variable is defined to something other than nil or "" I'm really wondering what kind of drugs I was on (or _not_ on) when I modified some of this from the Mongrel source.
2009-02-13test_upload: fix rename under 1.8
Ruby 1.9 Tempfile objects can be passed directly to File.rename (instead of the pathname). This doesn't work in 1.8, so always just pass the pathname to File.rename.
2009-02-13Remove tempfile reuse from HttpRequest, upload tests
Tempfile reuse was over-engineered and the problem was not nearly as big a problem as initially thought. Additionally, it could lead to a subtle bug in an applications that link(2)s or rename(2)s the temporary file to a permanent location _without_ closing it after the request is done. Applications that suffer from the problem of directory bloat are still free to modify ENV['TMPDIR'] to influence the creation of Tempfiles.
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-09Aggregate test results so they're more readable
Makes it much easier to track down failures if you know something failed in the first place. A failed test early on could be hidden because noise from successful tests drowned it out.
2009-02-09Remove test/ files we don't care about, update Manifest
We're not using them and they don't seem useful in any shape or form...
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-09Get rid of HeaderOut and simplify HttpResponse
Just stuff what little logic we had for it into HttpResponse since Rack takes care of the rest for us. Put the HTTP_STATUS_HEADERS hash in HttpResponse since we're the only user of it. Also, change HttpResponse.send to HttpResponse.write to avoid overriding the default method.
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-09Simplify HttpResponse since we only handle Rack now
The previous API was very flexible, but I don't think many people really cared for it... We now repeatedly use the same HeaderOut in each process since I completely don't care for multithreading.
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-02-09Allow running tests in parallel via gmake
Some of the tests here are horrifically slow due to sleeps, allow using gmake to run these tests in parallel. My Core2 Duo runs "make -j" over 10s faster than "rake".
2009-01-31No more special params hash.
2009-01-31Remove CGIWrapper.
2009-01-31Mongrel.run(app, opts)
2009-01-31Let the kernel schedule some shit.
2009-01-31Cleanup.
2009-01-31Started in test_server