Skip to content

Commit

Permalink
Fix CI with latest Rack
Browse files Browse the repository at this point in the history
Older versions provided backwards compatibility, but with the new major
version of rack, this has gone away.
  • Loading branch information
smortex committed Jun 29, 2024
1 parent d2b38d7 commit ea26dce
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions spec/riemann/tools/http_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
require 'openssl'
begin
require 'rackup/handler/webrick'
RACK_HANDLER = Rackup::Handler::WEBrick
rescue LoadError
# XXX: Needed for Ruby 2.6 compatibility
# Moved to the rackup gem in recent versions
require 'rack/handler/webrick'
RACK_HANDLER = Rack::Handler::WEBrick
end
require 'sinatra/base'
require 'webrick'
Expand Down Expand Up @@ -108,7 +110,7 @@ def protected!
Logger: WEBrick::Log.new(File.open(File::NULL, 'w')),
}
@server = WEBrick::HTTPServer.new(server_options)
@server.mount('/', Rack::Handler::WEBrick, TestWebserver)
@server.mount('/', RACK_HANDLER, TestWebserver)
@started = false
Thread.new { @server.start }
Timeout.timeout(1) { sleep(0.1) until @started }
Expand Down Expand Up @@ -260,7 +262,7 @@ def protected!
SSLCertName: '/CN=example.com',
}
@server = WEBrick::HTTPServer.new(server_options)
@server.mount('/', Rack::Handler::WEBrick, TestWebserver)
@server.mount('/', RACK_HANDLER, TestWebserver)
@started = false
Thread.new { @server.start }
Timeout.timeout(1) { sleep(0.1) until @started }
Expand Down

0 comments on commit ea26dce

Please sign in to comment.