about summary refs log tree commit homepage
path: root/test/helper.rb
DateCommit message (Collapse)
2019-05-09doc: favor File.read over IO.read to ease review
IO.read may invoke subprocesses, which can set off security warnings.
2018-12-08remove IO#close_on_exec= calls
Since we've required Ruby 2.0+ for a while, we can assume descriptors are created with IO#close_on_exec=true and avoid bloating our code with calls to it.
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).
2016-08-02test: skip some buffering tests on non-default values
It's too hard to reliably test output buffering behavior with non-default values users sometimes set; so just skip and warn about it for now. ref: commit dad99b5ecd93cdf0a514ff9fb51d198f8aebb188 ("test/test_proxy_pass: remove buffer size tuning")
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-06-15test/helper: warn atomically
We want to avoid race conditions if tests become multithreaded from Kernel#warn internally issuing a second write.
2015-06-10ensure body is closed during hijack
Middlewares such as Rack::Lock (used by Rails) break badly unless the response body is closed on hijack, so we will close it to follow the lead of other popular Rack servers. While it's unclear if there's anybody using rack.hijack besides yahns/proxy_pass we'll try to emulate the behavior of other servers as much as possible. ref: https://github.com/ngauthier/tubesock/issues/10 While we're at it, use DieIfUsed correctly in test_ssl.rb :x
2015-05-09ssl: ensure rack.hijack users get "normal" IO methods
We do not want rack.hijack users relying on kgio_* methods since kgio is trying to make itself obsolete (as Ruby itself adopts kgio features). This is a bit wonky since our common case tries to minimize object allocation by only using the Kgio::Socket derived class.
2014-03-13test/helper: compat w/ coverage in Feature #9508
There's a feature request for better coverage support in ruby-trunk https://bugs.ruby-lang.org/issues/9508 At minimum, we need to preserve compatibility; but we should set aside time to take advantage of the extra coverage support.
2013-12-27tests: document and check for ab(1) dependency
ab(1) is less common than our other dependencies, so allow tests to run without it.
2013-11-02add extras for exec_cgi and try_gzip_static
These applications are what I'll be using to run on yahns on my personal server. Including them here will be helpful for me to find bugs. I've already found some, the following commits were directly the result of playing with these extras: * stream_file: only close FDs we opened ourselves * worker-less server should not waitpid indiscriminately * http: do not drop Content-Range from response headers
2013-10-30add test for working_directory config parameter
This is often forgotten, and we need to make a tweak to the coverage generator to dump correctly.
2013-10-25enforce FD_CLOEXEC on all pipes, including tests
We need to prevent FD leakage on Ruby 1.9.3
2013-10-22test/helper: Dir.mktmpdir works without blocks
This is necessary for Ruby 1.9.3 compatibility.
2013-10-20tests: improve output to show RUBY_DESCRIPTION and full path
This should make it easier to figure out which installation of Ruby the tester is using.
2013-10-20test/helper: correctly handle exit code in test runner
Oops :x
2013-10-20test/helper: prevent minitest at_exit from running in children
Since we fork in tests, at_exit handlers may run in children and cause strange test failures. This seems necessary in minitest 5.0.8, but not 4.3.2. We also cannot use exit! in forked children because apps hosted on yahns will probably expect at_exit handlers they register to run.
2013-10-20tests: disable $-w on 1.9.3 to quiet down warnings
openssl warns about an unused variable
2013-10-19test/helper: fix __covmerge race for forked processes
flock works on file handles (which are shared across processes). So our use of flock on a global constant was not fork safe as the same file handle would share locks between the client/parent process. Since we have to create/truncate the coverage.dump file in the Makefile before any tests run anyways, we can just lazily open the file handle when we need to use it, and never before.
2013-10-18initial commit