Skip to content

Commit

Permalink
Merge pull request #2802 from newrelic/sliar
Browse files Browse the repository at this point in the history
CI: Rails v8.0 test fix, Rails v7.2 out of beta
  • Loading branch information
fallwith authored Aug 12, 2024
2 parents 260c4c8 + 195aaf7 commit 4f71983
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion test/environments/rails72/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source 'https://rubygems.org'

gem 'rails', '~> 7.2.0.beta2'
gem 'rails', '~> 7.2.0'
gem 'bootsnap', '>= 1.4.4', require: false

gem 'minitest', '5.2.3'
Expand Down
2 changes: 1 addition & 1 deletion test/multiverse/suites/rails/Envfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

RAILS_VERSIONS = [
[nil, 3.1],
['7.2.0.beta3', 3.1],
['7.2.0', 3.1],
['7.1.0', 2.7],
['7.0.4', 2.7],
['6.1.7', 2.5],
Expand Down
9 changes: 4 additions & 5 deletions test/multiverse/suites/rails/action_controller_other_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,11 @@ def test_send_data
end

def test_send_stream
# rails/rails@ed68af0 now defers all streaming behavior over to Rack (v3+) itself, so test
# only versions >= 7.2 and < 8.0
skip unless rails_version_at_least?('7.2') && !rails_version_at_least?('8.0.0.alpha')
skip unless rails_version_at_least?('7.2')

get('/data/send_test_stream')

assert_metrics_recorded(['Controller/data/send_test_stream', 'Ruby/ActionController/send_stream'])
assert_metrics_recorded(['Controller/data/send_test_stream'])
end

def test_halted_callback
Expand Down Expand Up @@ -231,7 +230,7 @@ def controller_class
def confirm_key_exists_in_params(node)
assertion_failure = "Expected to find the cache key >>#{DataController::CACHE_KEY}<< in the node params!"
# Rails v7.2+ stores the URI string, so look for the key on the end of it
if rails_version_at_least?('7.2.0.beta1')
if rails_version_at_least?('7.2.0')
assert_match(/#{CGI.escape("/#{DataController::CACHE_KEY}")}/, node.params[:key], assertion_failure)
# Rails < v7.2 stores the params in an array, so confirm it includes the key
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ def test_rails_middleware_records_metrics
def test_rails_routeset_is_instrumented
get('/')

assert_metrics_recorded(
# Rails v8.0+ uses lazy routing
metric = if rails_version_at_least?('8.0.0.alpha')
'Middleware/Rack/Rails::Engine::LazyRouteSet/call'
else
'Middleware/Rack/ActionDispatch::Routing::RouteSet/call'
)
end

assert_metrics_recorded(metric)
end

if Rails::VERSION::MAJOR >= 4
Expand Down

0 comments on commit 4f71983

Please sign in to comment.