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
[PR 1952] 2st verification - updated tests & GitHub Actions #1956
Changes from all commits
4471054
8d1d394
e907a0e
259d565
ea2c264
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Puma | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
name: >- | ||
OS: ${{ matrix.os }} Ruby: ${{ matrix.ruby }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ 'ubuntu-16.04', 'ubuntu-18.04', 'macos', 'windows-latest' ] | ||
ruby: [ '2.3.x', '2.4.x', '2.5.x', '2.6.x' ] | ||
exclude: | ||
- os: ubuntu-16.04 | ||
ruby: 2.4.x | ||
- os: ubuntu-16.04 | ||
ruby: 2.5.x | ||
- os: ubuntu-16.04 | ||
ruby: 2.6.x | ||
- os: ubuntu-18.04 | ||
ruby: 2.3.x | ||
- os: macos | ||
ruby: 2.3.x | ||
- os: windows-latest | ||
ruby: 2.3.x | ||
steps: | ||
- name: repo checkout | ||
uses: actions/checkout@v1 | ||
with: | ||
fetch-depth: 10 | ||
- name: load ruby | ||
uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby }} | ||
|
||
- name: ubuntu & macos - install ragel | ||
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') | ||
run: | | ||
if [ "${{ matrix.os }}" == "macos" ]; then | ||
brew install ragel | ||
else | ||
sudo apt-get install ragel | ||
fi | ||
- name: windows - update MSYS2, openssl, ragel | ||
if: startsWith(matrix.os, 'windows') | ||
uses: MSP-Greg/msys2-action@master | ||
with: | ||
base: update | ||
mingw: openssl ragel | ||
|
||
- name: RubyGems, Bundler Update | ||
run: gem update --system --no-document --conservative | ||
- name: bundle install | ||
run: bundle install --jobs 4 --retry 3 | ||
- name: compile | ||
run: bundle exec rake compile | ||
- name: test | ||
run: bundle exec rake | ||
env: | ||
CI: true | ||
TESTOPTS: -v |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -217,11 +217,12 @@ def restart_args | |
end | ||
|
||
def close_binder_listeners | ||
@binder.listeners.each do |l, io| | ||
io.close | ||
# close binder listeners as fast as possible, so separate loop | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We want the listener sockets closed quickly once shutdown starts. Anything that requires checking the disk can slow down. Small issue. |
||
@binder.listeners.each { |_, io| io.close } | ||
@binder.listeners.each do |l, _| | ||
uri = URI.parse(l) | ||
next unless uri.scheme == 'unix' | ||
File.unlink("#{uri.host}#{uri.path}") | ||
File.unlink "#{uri.host}#{uri.path}" | ||
end | ||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
worker_shutdown_timeout 2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,11 @@ module UniquePort | |
@mutex = Mutex.new | ||
|
||
def self.call | ||
@mutex.synchronize { @port += 1 } | ||
@mutex.synchronize { | ||
@port += 1 | ||
@port = 3307 if @port == 3306 # MySQL on Actions | ||
@port | ||
} | ||
end | ||
end | ||
|
||
|
@@ -70,6 +74,34 @@ def run(*) | |
|
||
module TestSkips | ||
|
||
# finds bad signals, value is an array of symbols | ||
BAD_SIGNAL_LIST = begin | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a huge fan of this, what's wrong with Signal.list? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Windows Signal.list includes Needed a process to kill to test for it... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I appreciate the idea, but let's just remove :TERM from the list if on Windows, this spawning-a-process thing feels like the nuclear option. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, if :TERM doesnt work on windows, why do tests that use not fail? e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Of of course, because you can't fork on windows. D'oh! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Understandable. I really hate defining by OS, as opposed to actually checking for functionality. Maybe it ( |
||
code = <<-HEREDOC | ||
data = (%w[HUP INT TTIN TTOU USR1 USR2] - Signal.list.keys).join(' ') | ||
|
||
begin | ||
Signal.trap('TERM') { } | ||
rescue ArgumentError | ||
data << 'TERM' | ||
end | ||
|
||
puts data | ||
HEREDOC | ||
pipe = IO.popen RbConfig.ruby, 'r+' | ||
pid = pipe.pid | ||
pipe.puts code | ||
pipe.close_write | ||
|
||
begin | ||
Process.kill :TERM, pid | ||
pipe.read.strip.split(' ').sort.map(&:to_sym) | ||
rescue Errno::EINVAL | ||
"#{pipe.read.strip} TERM".split(' ').sort.map(&:to_sym) | ||
ensure | ||
Process.wait pid | ||
end | ||
end | ||
|
||
# usage: skip NO_FORK_MSG unless HAS_FORK | ||
# windows >= 2.6 fork is not defined, < 2.6 fork raises NotImplementedError | ||
HAS_FORK = ::Process.respond_to? :fork | ||
|
@@ -82,8 +114,8 @@ module TestSkips | |
|
||
# usage: skip_unless_signal_exist? :USR2 | ||
def skip_unless_signal_exist?(sig, bt: caller) | ||
signal = sig.to_s | ||
unless Signal.list.key? signal | ||
signal = sig.to_s.sub(/\ASIG/i, '').to_sym | ||
if BAD_SIGNAL_LIST.include? signal | ||
skip "Signal #{signal} isn't available on the #{RUBY_PLATFORM} platform", bt | ||
end | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# call with "GET /sleep<d> HTTP/1.1\r\n\r\n", where <d> is the number of | ||
# seconds to sleep, returns process pid | ||
|
||
run lambda { |env| | ||
dly = (env['REQUEST_PATH'][/\/sleep(\d+)/,1] || '0').to_i | ||
sleep dly | ||
[200, {"Content-Type" => "text/plain"}, ["Slept #{dly} #{Process.pid}"]] | ||
} |
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 doesn't fix the problem, as bind paths are still not removed after program stop.
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.
A few days ago, I was really clear on what was where in terms of Binder
@ios
,@unix_paths
, and@listeners
. I should have added some comments...Paths are closed in
Binder#close_listeners
, They aren't inBinder#close
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 this assertion I've added to master. Anything that purports to fix this problem needs to pass this test (which is failing on master).