Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PluginRegistry#fire_background - fix up per issue 1972 (#1973)
* PluginRegistry#fire_background - Close #1972 * add test/test_plugin.rb, test/config/plugin1.rb
- Loading branch information
1 parent
db74ad4
commit 544bb7a
Showing
3 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
plugin 'tmp_restart' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require_relative "helper" | ||
require_relative "helpers/integration" | ||
|
||
class TestPlugin < TestIntegration | ||
def test_plugin | ||
skip "Skipped on Windows Ruby < 2.5.0, Ruby bug" if windows? && RUBY_VERSION < '2.5.0' | ||
@tcp_bind = UniquePort.call | ||
@tcp_ctrl = UniquePort.call | ||
|
||
Dir.mkdir("tmp") unless Dir.exist?("tmp") | ||
|
||
cli_server "-b tcp://#{HOST}:#{@tcp_bind} --control-url tcp://#{HOST}:#{@tcp_ctrl} --control-token #{TOKEN} -C test/config/plugin1.rb test/rackup/hello.ru" | ||
File.open('tmp/restart.txt', mode: 'wb') { |f| f.puts "Restart #{Time.now}" } | ||
|
||
true while (l = @server.gets) !~ /Restarting\.\.\./ | ||
assert_match(/Restarting\.\.\./, l) | ||
|
||
true while (l = @server.gets) !~ /Ctrl-C/ | ||
assert_match(/Ctrl-C/, l) | ||
|
||
out = StringIO.new | ||
|
||
cli_pumactl "-C tcp://#{HOST}:#{@tcp_ctrl} -T #{TOKEN} stop" | ||
true while (l = @server.gets) !~ /Goodbye/ | ||
|
||
@server.close | ||
@server = nil | ||
out.close | ||
end | ||
|
||
private | ||
|
||
def cli_pumactl(argv) | ||
pumactl = IO.popen("#{BASE} bin/pumactl #{argv}", "r") | ||
@ios_to_close << pumactl | ||
Process.wait pumactl.pid | ||
pumactl | ||
end | ||
end |