about summary refs log tree commit homepage
path: root/test/test_bin.rb
DateCommit message (Collapse)
2018-12-08@srv.shutdown could raise Errno::ENOTCONN
After this fix, all tests except test_client_expire are passing on my system (macos 10.12.6). Honestly, I don't really care if it's working perfectly fine. It's just nice to be able to run the same server on development machine. Production is of course Linux.
2018-05-01tests: thread-safety fixes
We can't require 'proxy_pass' in both a parent and forked child, so require it up front (as kcar will become a hard dependency in place of unicorn). Then, rely on GTL (global test lock) to synchronize around fork since the VM may not always be able to protect that. However, there's no need to synchronize around spawn/system/`backtick`, as the VM should always be using those in a thread-safe way (via vfork).
2017-04-06allow omitting specifying socket name when inheriting listen socket
Since the common case is still to run a single app inside yahns, we can simplify setup a bit for systemd (and like) users by allowing them to omit the "listen" directive when they are running a single app in yahns.
2017-04-06test_bin: use RbConfig.ruby for non-standard names
It's possible to have "ruby" executables by other names (e.g. "ruby24"), so use a supported API for finding our executable. This feature was added in Ruby 1.9.2, so it's safe to use as we've always been 1.9.3+ (and nowadays 2.0+)
2017-04-03test_bin: SO_KEEPALIVE value only needs to be true
On FreeBSD 10.3 (and presumably other *BSD TCP stacks, the value of SO_KEEPALIVE returned by getsockopt is 8, even when set to '1' via setsockopt. Relax the test to only ensure the boolean value is interpreted as "true". Verified independently of Ruby using the following: --------8<--------- #include <sys/types.h> #include <sys/socket.h> #include <stdio.h> static int err(const char *msg) { perror(msg); return 1; } int main(void) { int sv[2]; int set = 1; int got; socklen_t len = (socklen_t) sizeof(int); int rc; rc = socketpair(PF_LOCAL, SOCK_STREAM, 0, sv); if (rc) return err("socketpair failed"); rc = setsockopt(sv[0], SOL_SOCKET, SO_KEEPALIVE, &set, len); if (rc) return err("setsockopt failed"); rc = getsockopt(sv[0], SOL_SOCKET, SO_KEEPALIVE, &got, &len); if (rc) return err("getsockopt failed"); printf("got: %d\n", got); return 0; }
2016-02-29test/*: fix mktmpdir usage for 1.9.3
We should not infinite loop, oops :x Also, ensure 'yahns' is in the directory in case tests are SIGKILL-ed and directories are left over.
2016-01-02copyright updates for 2016
Using the 'update-copyright' script from gnulib[1]: git ls-files | UPDATE_COPYRIGHT_HOLDER='all contributors' \ UPDATE_COPYRIGHT_USE_INTERVALS=2 \ xargs /path/to/gnulib/build-aux/update-copyright We're also switching to 'GPL-3.0+' as recommended by SPDX to be consistent with our gemspec and other metadata (as opposed to the longer but equivalent "GPLv3 or later"). [1] git://git.savannah.gnu.org/gnulib.git
2016-01-02enable frozen_string_literal for Ruby 2.3+
There are likely yet-to-be-discovered bugs in here. Also, keeping explicit #freeze calls for 2.2 users, since most users have not migrated to 2.3, yet.
2015-10-13copyright updates
Future updates may use the update-copyright script in gnulib: git ls-files | UPDATE_COPYRIGHT_HOLDER='all contributors' \ UPDATE_COPYRIGHT_USE_INTERVALS=2 \ xargs /path/to/gnulib/build-aux/update-copyright
2015-07-15emulate sd_listen_fds for systemd support
systemd socket emulation shares FDs across execve, just like the built-in SIGUSR2 upgrade process in unicorn. Thus it is easy to support inheriting sockets from systemd.
2013-10-25enforce FD_CLOEXEC on all pipes, including tests
We need to prevent FD leakage on Ruby 1.9.3
2013-10-22tests: do not lose exceptions on quit timeouts
We should see the reason for test failures.
2013-10-21test_bin: shutdown socket when not inheriting
close/FD_CLOEXEC may be insufficient since the socket could be released asynchronously, leading to occasional test failures. Even with a synchronous close/FD_CLOEXEC, there's a chance of a race because the server does not bind the socket right away.
2013-10-21wip for EADDRINUSE failure
2013-10-21tests: support disabling parallelization env
Temporarily disabling parallel tests maybe needed to diagnose some problems with tests.
2013-10-20test_bin: set close-on-exec for Ruby 1.9.3 compatibility
2013-10-19test_bin: add additional tests for SIGHUP
We can just add it into the SIGUSR2 test for now.
2013-10-19SIGUSR2 handling uses Process.spawn + tests
We no longer have to worry about 1.8 compatibility, so use Process.spawn and shorten our code. Also, add tests for this functionality.
2013-10-18test: cleanup socket usage and lifetimes
This should help prevent us from running out of FDs prematurely as our test suite becomes more multi-threaded. We can also use plain TCPSocket in tests where we inherit the file descriptor from the parent (w/o accept).
2013-10-18initial commit