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 19, 2024
1 parent a034cdc commit b3f2c84
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions spec/riemann/tools/http_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ def protected!
end

RSpec.describe Riemann::Tools::HttpCheck, if: Gem::Version.new(RUBY_VERSION) >= Gem::Version.new(Riemann::Tools::HttpCheck::REQUIRED_RUBY_VERSION) do
# XXX: Needed for Ruby 2.6 compatibility
let(:rack_handler) do
if Object.const_defined?('Rackup::Handler::WEBrick')
Rackup::Handler::WEBrick
else
Rack::Handler::WEBrick
end
end
describe '#endpoint_name' do
subject { described_class.new.endpoint_name(address, port) }

Expand Down Expand Up @@ -108,7 +116,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 +268,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 b3f2c84

Please sign in to comment.