New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Draft] Various test-suite speed/reliability improvements #2241
Conversation
@@ -9,6 +9,8 @@ jobs: | |||
env: | |||
CI: true | |||
TESTOPTS: -v | |||
MT_CPU: 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Niiice.
require "timeout" | ||
module TimeoutEveryTestCase | ||
# our own subclass so we never confused different timeouts | ||
class TestTookTooLong < Timeout::Error | ||
end | ||
|
||
def run(*) | ||
::Timeout.timeout(RUBY_ENGINE == 'ruby' ? 60 : 120, TestTookTooLong) { super } | ||
::Timeout.timeout(RUBY_ENGINE == 'ruby' ? 10 : 120, TestTookTooLong) { super } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DELICIOUS
|
||
require 'openssl' | ||
# Silence warnings on SSLSocket initialization. | ||
module SSLSocketFix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you point me to where these warnings happen currently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a Ruby 2.2 warning
@@ -10,30 +10,30 @@ class TestIntegration < Minitest::Test | |||
TOKEN = "xxyyzz" | |||
WORKERS = 2 | |||
|
|||
BASE = defined?(Bundler) ? "bundle exec #{Gem.ruby} -Ilib" : | |||
"#{Gem.ruby} -Ilib" | |||
BASE = "#{Gem.ruby} -rrubygems -Ilib" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might break tests for people running locally. In CI it will be fine of course. Not sure if we can do this.
@@ -1,10 +1,16 @@ | |||
system "ruby -rrubygems -Ilib bin/puma -p 10102 -C test/shell/t1_conf.rb test/rackup/hello.ru &" | |||
tcp_port = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #2240, I want to just get rid of this folder and replace with normal tests.
@@ -4,6 +4,7 @@ | |||
|
|||
require "puma/app/status" | |||
require "rack" | |||
require "rack/mock" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
required but not used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this eliminated a 'circular require considered harmful' warning on Ruby 2.2.
@@ -44,22 +36,14 @@ def hit(uris) | |||
end | |||
end | |||
|
|||
module UniquePort | |||
def self.call | |||
TCPServer.open('127.0.0.1', 0) do |server| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YES
@@ -2,15 +2,6 @@ | |||
# Copyright (c) 2011 Evan Phoenix | |||
# Copyright (c) 2005 Zed A. Shaw | |||
|
|||
if %w(2.2.7 2.2.8 2.2.9 2.2.10 2.3.4 2.4.1).include? RUBY_VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm... why though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why move to lib I mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I saw integration tests running Puma in a subprocess still encountering this issue on Ruby2.2. Plus I figured it made sense to warn anyone on relevant Ruby versions possibly affected by this issue that weren't already using the gem.
Hopefully not super important though since 2.2 support probably won't last much longer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're doing a major release next, I'll revisit that policy. Dropping 2.2 especially would really help for SSL maintenance.
Gut reaction: yes, yes, and hell yes. Ready to discuss these individually/in 100-line chunks when you are. |
Returning to this draft after being idle for a while - I've updated the original description, crossing out items that have since been broken out into separate smaller PRs (and cross-referencing them). Next up I plan to rebase this PR to remove those parts that have been merged. After that I plan to break out two final pieces into separate PRs:
After one more rebase, that should leave the test-suite speed improvements in this PR for review. |
Nice to have you back @wjordan :) |
@wjordan will close these for now, let me know if you want to come back to them |
Description
Spike with a bunch of different changes focused on improving the speed and reliability of the test suite. The goal was just to quickly experiment with running tests faster and with fewer flaky failures, and to share some of the high-level ideas for early discussion. Next step would be to break out the most useful fixes/changes into smaller PRs to be merged separately.
Highlights
MT_CPU
from default 2 to 10)sleep 1
tosleep 0.01
)UniquePort
implementation with port 0 in all tests (UniquePort
has a race condition that can cause intermittent port conflicts) (Stabilize CI testing? [changelog skip] #2270)The following changes have since been broken out into separate smaller PRs:
Fire(Fire on_booted after server starts #2431)on_booted
after server starts (fixes TestCLI#test_control failing with "pool_capacity": 0 #2212)Catch more stream-interruption errors ((Improve worker shutdown reliability, CI fixes #2312)EPIPE
, etc) that can happen during shutdown/thread-exit racesCatch and handle ThreadPool::ForceShutdown errors throughout entire threadpool lifecycle(Better error handling during force shutdown #2271)Add mutex for adding connections to reactor based on(Better error handling during force shutdown #2271 / Prevent connections from entering Reactor after shutdown begins #2377)queue_requests
Fix some race conditions / edge-cases in Reactor (process multiple triggers in single cycle, re-add timeout when client-request isn't ready to be added back to thread pool [issue Minor timeout bug in Reactor #2282])(Reactor refactor #2279)Move shell tests into Minitest class so they can be run in parallel([changelog skip] Move integration logging test to main test suite #2240, [changelog skip] Move integration logging test to main test suite #2346, [changelog skip] Move integration logging test to main test suite #2347)Performance
Your checklist for this pull request
[changelog skip]
the pull request title.[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.