Skip to content
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

test+ci: Test with Rack 3.x #320

Merged
merged 1 commit into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ workflows:
- "./gemfiles/net_http_01.gemfile"
- "./gemfiles/rack_16.gemfile"
- "./gemfiles/rack_20.gemfile"
- "./gemfiles/rack_30.gemfile"
- "./gemfiles/redis_40.gemfile"
- "./gemfiles/rest_client_16.gemfile"
- "./gemfiles/rest_client_20.gemfile"
Expand Down
16 changes: 16 additions & 0 deletions gemfiles/rack_30.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# (c) Copyright IBM Corp. 2023

source "https://rubygems.org"

gem "rake"
gem "minitest", "5.9.1"
gem "minitest-reporters"
gem "webmock"
gem "puma"
gem "rubocop", "~> 1.9"
gem "rack-test"
gem "simplecov", "~> 0.21.2"
gem "rack", ">= 3.0.8"
gem "rackup", ">= 2.1.0"

gemspec path: "../"
15 changes: 13 additions & 2 deletions test/instrumentation/rack_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@

require 'test_helper'
require 'rack/test'
require 'rack/lobster'

framework_version = Gem::Specification.find_by_name('rack').version
if framework_version < Gem::Version.new('3.0.0')
require 'rack/lobster'
else
require 'rackup/lobster'
end

class RackTest < Minitest::Test
include Rack::Test::Methods
Expand Down Expand Up @@ -34,11 +40,16 @@ def call(_env)
end

def app
framework_version = Gem::Specification.find_by_name('rack').version
@app = Rack::Builder.new do
use Rack::CommonLogger
use Rack::ShowExceptions
use Instana::Rack
map("/mrlobster") { run Rack::Lobster.new }
if framework_version < Gem::Version.new('3.0.0')
map("/mrlobster") { run Rack::Lobster.new }
else
map("/mrlobster") { run Rackup::Lobster.new }
end
map("/path_tpl") { run PathTemplateApp.new }
map("/error") { run ErrorApp.new }
map("/five_zero_one") { run FiveZeroOneApp.new }
Expand Down
Loading