Skip to content

Commit

Permalink
Merge pull request #2754 from newrelic/railsedge
Browse files Browse the repository at this point in the history
Re-enable Rails EDGE CI testing, address Rails v8.0-alpha specific issues
  • Loading branch information
fallwith authored Jul 18, 2024
2 parents bd5c34a + 1bb14e9 commit 1d39781
Show file tree
Hide file tree
Showing 13 changed files with 145 additions and 260 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ jobs:
"rails": "norails,rails61,rails60,rails70,rails71"
},
"3.1.6": {
"rails": "norails,rails61,rails70,rails71,rails72"
"rails": "norails,rails61,rails70,rails71,rails72,railsedge"
},
"3.2.4": {
"rails": "norails,rails61,rails70,rails71,rails72"
"rails": "norails,rails61,rails70,rails71,rails72,railsedge"
},
"3.3.4": {
"rails": "norails,rails61,rails70,rails71,rails72"
"rails": "norails,rails61,rails70,rails71,rails72,railsedge"
},
"3.4.0-preview1": {
"rails": "norails,rails61,rails70,rails71,rails72"
"rails": "norails,rails61,rails70,rails71,rails72,railsedge"
}
}
Expand Down
18 changes: 11 additions & 7 deletions lib/new_relic/rack/browser_monitoring.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ class BrowserMonitoring < AgentMiddleware
# examine in order to look for a RUM insertion point.
SCAN_LIMIT = 50_000

CONTENT_TYPE = 'Content-Type'.freeze
CONTENT_DISPOSITION = 'Content-Disposition'.freeze
CONTENT_LENGTH = 'Content-Length'.freeze
CONTENT_TYPE = 'Content-Type'
CONTENT_DISPOSITION = 'Content-Disposition'
CONTENT_LENGTH = 'Content-Length'
ATTACHMENT = /attachment/.freeze
TEXT_HTML = %r{text/html}.freeze

BODY_START = '<body'.freeze
HEAD_START = '<head'.freeze
GT = '>'.freeze
BODY_START = '<body'
HEAD_START = '<head'
GT = '>'

ALREADY_INSTRUMENTED_KEY = 'newrelic.browser_monitoring_already_instrumented'
CHARSET_RE = /<\s*meta[^>]+charset\s*=[^>]*>/im.freeze
Expand Down Expand Up @@ -120,7 +120,11 @@ def attachment?(headers)
end

def streaming?(env, headers)
# Chunked transfer encoding is a streaming data transfer mechanism available only in HTTP/1.1
# Up until version 8.0, Rails would set 'Transfer-Encoding' to 'chunked'
# to trigger the desired HTTP/1.1 based streaming functionality in Rack.
# With version v8.0+, Rails assumes that the web server will be using
# Rack v3+ or an equally modern alternative and simply leaves the
# streaming behavior up to them.
return true if headers && headers['Transfer-Encoding'] == 'chunked'

defined?(ActionController::Live) &&
Expand Down
9 changes: 9 additions & 0 deletions test/agent_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1043,3 +1043,12 @@ def first_call_for(subject)
def ruby_version_float
RUBY_VERSION.split('.')[0..1].join('.').to_f
end

def rails_version
@rails_version ||= Gem::Version.new(Rails::VERSION::STRING)
end

def rails_version_at_least?(version_string)
version_string += '.0' until version_string.count('.') >= 2 # '7' => '7.0.0'
rails_version >= Gem::Version.new(version_string)
end
7 changes: 7 additions & 0 deletions test/environments/railsedge/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ end

gem 'simplecov' if ENV['VERBOSE_TEST_OUTPUT']
gem 'warning'

if RUBY_VERSION.split('.')[0..1].join('.').to_f >= 3.4
gem 'base64'
gem 'bigdecimal'
gem 'mutex_m'
gem 'ostruct'
end
2 changes: 1 addition & 1 deletion test/environments/railsedge/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
module RpmTestApp
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults(7.0) # TODO: keep this number up to date (and keep this TODO)
config.load_defaults(8.0) # TODO: keep this number up to date (and keep this TODO)
config.eager_load = false
config.filter_parameters += [:password]
end
Expand Down
Loading

0 comments on commit 1d39781

Please sign in to comment.