about summary refs log tree commit homepage
path: root/test
DateCommit message (Collapse)
2009-04-27test_upload: still uncomfortable with 1.9 IO encoding...
It seems most applications use buffered IO#read instead of IO#sysread. So make sure our encoding is set correctly for buffered IO#read applications, too.
2009-04-25test_request: enable with Ruby 1.9 now Rack 1.0.0 is out
2009-04-24configurator: "listen" directive more nginx-like
The following specifications to bind port 8080 on all interfaces are now accepted in the configuration file: listen "8080" # (with quotes) listen 8080 # (without quotes)
2009-04-24SIGTT{IN,OU} {in,de}crements worker_processes
This allows dynamic tuning of the worker_processes count without having to restart existing ones. This also allows worker_processes to be set to a low initial amount in the config file for low-traffic deployments/upgrades and then scaled up as the old processes are killed off. Remove the proposed reexec_worker_processes from TODO since this is far more flexible and powerful. This will allow not-yet-existent third-party monitoring tools to dynamically change and scale worker processes according to site load without increasing the complexity of Unicorn itself.
2009-04-23http_response: minor performance gains
Avoid creating garbage every time we lookup the status code along with the message. Also, we can use global const arrays for a little extra performance because we only write one-at-a time Looking at MRI 1.8, Array#join with an empty string argument is slightly better because it skips an append for every iteration.
2009-04-23test_socket_helper: disable GC for this test
Otherwise the GC will unlink sockets. A better solution (purgatory?) may be needed...
2009-04-23test_exec: cleanup stale socket on exit
2009-04-23Fix data corruption with small uploads via browsers
StringIO.new(partial_body) does not update the offset for new writes. So instead create the StringIO object and then syswrite to it and try to follow the same code path used by large uploads which use Tempfiles.
2009-04-21test: empty port test for absolute URIs
2009-04-21http11: support underscores in URI hostnames
They aren't common, but apparently there exist URLs with them, so we'll support them.
2009-04-21Stop extending core classes
This removes the #unicorn_peeraddr methods from TCPSocket and UNIXSocket core classes. Instead, just move that logic into the only place it needs to be used in HttpRequest.
2009-04-21http11: rfc2616 handling of absolute URIs
We now parse the scheme, host and port from Absolute URIs and ignore them if the equivalents are specified in the other headers.
2009-04-21http11: make parser obey HTTP_HOST with empty port
This means "Host: foo-bar:" (trailing colon) will assume server_port is 80, not a blank string.
2009-04-21HttpParser: set QUERY_STRING for Rack-compliance
2009-04-21Move absolute URI parsing into HTTP parser
It's part of the HTTP/1.1 (rfc2616), so we might as well handle it in there and set PATH_INFO while we're at it. Also, make "OPTIONS *" test not fail Rack::Lint
2009-04-16test_upload: ensure StringIO objects are binary
Sockets always return binary encoded data, so when StringIO.new(string) is called, that StringIO object inherits the encoding of the initial string it was created with. And yes, Ruby 1.9 still makes me seriously uncomfortable with I/O manipulation since the encoding layer does things behind my back. UNIX is (and should always be) just a bag of bytes! Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-04-16Small garbage reduction in HttpResponse
Avoid creating new string objects and then discarding them right away by stuffing non-constant but always-present headers into the initial output.
2009-04-16Fix forgotten Rails tests
This was broken in 66841a0164bc03eddb7a6ac31e3923302dbc5146: ensure responses always have the "Status:" header
2009-04-16ensure responses always have the "Status:" header
There are weird (and possibly broken) clients out there that require it despite being present in the first line of the response. So be nice and accomodate them. Keep in mind that the Rack SPEC explicitly forbids this header from being in the headers returned by the Rack-based application; so we have to always inject it ourselves and ignore it if the application sets it.
2009-04-14s/rotating/reopening/g in log messages
We don't (and won't ever) do log rotation within the process. That's the job of logrotate and tools like that. We just reopen logs like other reasonable daemons out there.
2009-04-13Fix SIGINT/SIGTERM handling (broken in 0.5.0)
By reraising SignalException in workers. Since we just rely on default signal handlers for the majority of signals now, ensure those signals actually exit the process.
2009-04-13Expose worker to {before,after}_fork hooks
Instead of just worker.nr. This is a configuration file/API change and will break existing configurations. This allows worker.tempfile to be exposed to the hooks so ownership changes can still happen on it. On the other hand, I don't know of many people actually using this feature (or Unicorn).
2009-04-12test_http_parser: fix broken URL in comment
This was back when I did s/mongrel/Unicorn/g on the sources.
2009-04-12test_exec: fix potential races in fd leak test
We need to ensure children are spawned by waiting until the master is ready.
2009-04-12http11: cleanup+safer rack.url_scheme handling
Avoid using strcmp() since it could break badly if Ruby ever stopped null-terminating strings C-style. We're also freezing "http" as a global. Rack does not explicitly permit nor deny this, and Mongrel has always used frozen strings as hash values in other places.
2009-04-10listen backlog, sndbuf, rcvbuf are always changeable
Apparently I was smoking crack and thought they weren't changeable. Additionally, SO_REUSEADDR is set by TCPServer.new, so there's no need to set it ourselves; so avoid putting extra items in the purgatory. This allows SIGHUP to change listen options.
2009-04-10Restore unlinked UNIX sockets on SIGHUP
Sockets may be unintentionally unlinked on the filesystem. When reloading our config, ensure that the socket exists on the filesystem. If not, close the listener (since it's unusable by outside apps) and reopen it.
2009-04-10config: handle listener unbind/replace in config file
Rather than blindly appending to our listener set with every "listen" directive read in the config file, reset our internal array. Listeners specified on the command-line are always preserved between config reloads.
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-08http11: handle "X-Forwarded-Proto: https"
Pass "https" to "rack.url_scheme" if the X-Forwarded-Proto header matches "https". X-Forwarded-Proto is a semi-standard header that Ruby frameworks seem to respect; so we use that. We won't support ENV['HTTPS'] since that can only be set at start time and some app servers supporting https also support http. Currently, "rack.url_scheme" only allows "http" and "https", so we won't set anything else to avoid breaking Rack::Lint.
2009-04-08test_request: tests esoteric/rare REQUEST_URIs
* Test for '*' in "OPTIONS * HTTP/1.1" for now (even though Rack doesn't like it). * Some clients can send absolute URIs, too
2009-04-05test_configurator: rename test name that never ran
Run tests with warnings so we detect stupid things like this.
2009-04-05Add test for :preload_app config option
2009-04-05Enforce umask 0000 with UNIX domain sockets
I can't think of a good reason to ever use restrictive permissions with UNIX domain sockets for an HTTP server. Since some folks run their nginx on port 80 and then have it drop permissions, we need to ensure our socket is readable and writable across the board. The reason I'm respecting the existing umask at all (instead of using 0000 across the board like most daemonizers) is because the admin may want to restrict access (especially write access) to log files.
2009-04-03Add a test for signal recovery
I/O on slow descriptors can be interrupted so make sure we (and Ruby itself) are handling EINTR correctly.
2009-04-03configurator: allow hooks to be passed callable objects
Premade lambda/proc/Proc objects may all be passed, to the hooks, not just anonymous blocks.
2009-04-03test_helper: redirect_io uses append and sync
In case redirect_io is called multiple times, we don't want to lose debugging output.
2009-04-02Add log directories to tests
Not sure if unicorn_rails should create them since the builtin Rails server only creates things under tmp/*.
2009-04-02test/rails: v2.1.2 + ActiveRecordStore all around
Recent changes made to the unicorn_rails loader were needed to get ActiveRecordStore to load correctly.
2009-04-01test_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.
2009-04-01FD_CLOEXEC all non-listen descriptors before exec
We'll allow before_exec to override that setting, however. There are cases where someone setting Logger.new("/path/to/file") will create new file descriptors in the master process. This will prevent FD leakage and a test case (for Linux only) proves it.
2009-04-01test_exec: add test case for per-worker listeners
2009-04-01test_rails: 4x speedup
Loading Rails takes a very long time, so consolidate most of the tests into one big test that allows us to avoid loading Rails. It makes the test less like unit tests, but they could still be split up into private functions if one wants to run them individually.
2009-04-01Add more tests for Rails
Additional tests for Rails have been added * cookies and sessions * POST requests * POST requests with multipart uploads * 404 handling * static file serving * cached static file serving (resources with ";" caching in some old 1.2.x version not yet tested)
2009-03-31test: factor out exec helpers into common code for Rails tests
2009-03-31Rails stack tests for unicorn_rails
Very preliminary for now. Basically just sets up a basic controller and response. Requires git to clone the official Rails repository.
2009-03-31Better canonicalization of listener paths + tests
* Expand addresses like "1:8080" to "127.0.0.1:8080" beforehand so sock_name() in SocketHelper will always return consistent results. * Add support for "unix:/path/to/foo" paths for easier synchronization with nginx config files.
2009-03-29test_exec: fix another race condition
2009-03-29test_exec: fix response bodies
They were non-conformant for the longest time
2009-03-29test_exec: fix race conditions
We need to ensure the QUIT signal to the old processes are processed when fixing the config. Additionally, the log rotation checker was not reliable because the master log emitted a similar message to the workers and we were not distinguishing between them. Check for all 5 logs (1 master + 4 workers) to be rotated.