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

Add Ruby 3.3 to CI #808

Merged
merged 5 commits into from
Jan 8, 2024
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
14 changes: 7 additions & 7 deletions .github/workflows/maze-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: ['1.9', '3.2']
ruby-version: ['1.9', '3.3']

uses: ./.github/workflows/run-maze-runner.yml
with:
Expand Down Expand Up @@ -36,11 +36,11 @@ jobs:
rack-version: '1'
- ruby-version: '2.2'
rack-version: '2'
- ruby-version: '3.2'
- ruby-version: '3.3'
rack-version: '2'
- ruby-version: '2.4'
rack-version: '3'
- ruby-version: '3.2'
- ruby-version: '3.3'
rack-version: '3'

uses: ./.github/workflows/run-maze-runner.yml
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
ruby-version: ['2.5', '2.7']
sidekiq-version: ['2', '3', '4', '5', '6', '7']
include:
- ruby-version: '3.2'
- ruby-version: '3.3'
sidekiq-version: '7'
exclude:
# 2.7 is the minimum ruby version that sidekiq 7 supports
Expand Down Expand Up @@ -127,15 +127,15 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: ['2.7', '3.2']
ruby-version: ['2.7', '3.3']
rails-version: ['6', '7', '_integrations']
include:
- ruby-version: '2.5'
rails-version: '6'
exclude:
- ruby-version: '2.7'
rails-version: '6'
- ruby-version: '3.2'
- ruby-version: '3.3'
rails-version: '_integrations'

uses: ./.github/workflows/run-maze-runner.yml
Expand All @@ -148,7 +148,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: ['1.9', '2.0', '2.1', '2.2', '2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2']
ruby-version: ['1.9', '2.0', '2.1', '2.2', '2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3']

uses: ./.github/workflows/run-maze-runner.yml
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2']
ruby-version: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3']
optional-groups: ['test sidekiq']
include:
- ruby-version: '1.9'
Expand Down
3 changes: 2 additions & 1 deletion features/fixtures/plain/app/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ def configure_basics
Bugsnag.configure do |conf|
conf.api_key = ENV['BUGSNAG_API_KEY']
conf.set_endpoints(ENV['BUGSNAG_ENDPOINT'], ENV["BUGSNAG_ENDPOINT"])
conf.project_root = File.dirname(File.realpath(__FILE__))
end
end

Expand All @@ -17,7 +18,7 @@ def configure_using_environment
conf.ignore_classes << lambda { |ex| ex.class.to_s == ENV["BUGSNAG_IGNORE_CLASS"] } if ENV.include? "BUGSNAG_IGNORE_CLASS"
conf.meta_data_filters << ENV["BUGSNAG_META_DATA_FILTERS"] if ENV.include? "BUGSNAG_META_DATA_FILTERS"
conf.enabled_release_stages = [ENV["BUGSNAG_NOTIFY_RELEASE_STAGE"]] if ENV.include? "BUGSNAG_NOTIFY_RELEASE_STAGE"
conf.project_root = ENV["BUGSNAG_PROJECT_ROOT"] if ENV.include? "BUGSNAG_PROJECT_ROOT"
conf.project_root = File.dirname(File.realpath(__FILE__))
conf.proxy_host = ENV["BUGSNAG_PROXY_HOST"] if ENV.include? "BUGSNAG_PROXY_HOST"
conf.proxy_password = ENV["BUGSNAG_PROXY_PASSWORD"] if ENV.include? "BUGSNAG_PROXY_PASSWORD"
conf.proxy_port = ENV["BUGSNAG_PROXY_PORT"] if ENV.include? "BUGSNAG_PROXY_PORT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

callback = Proc.new do |report|
report.exceptions[0][:stacktrace].each_with_index do |frame, index|
if index > 0
if index == 0
frame[:inProject] = nil
else
frame[:inProject] = true
end
end
end

run(callback)
run(callback)
3 changes: 2 additions & 1 deletion features/fixtures/rails7/app/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ gem "rails", "~> 7.0.1"
gem "sprockets-rails"

# Use sqlite3 as the database for Active Record
gem "sqlite3", "~> 1.4"
# Install a compatible sqlite version on Ruby <3.0
gem "sqlite3", RUBY_VERSION >= '3.0' ? "~> 1.7" : "< 1.7"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"
Expand Down
6 changes: 3 additions & 3 deletions features/plain_features/handled_errors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Scenario: A rescued exception sends a report
And the event "severityReason.type" equals "handledException"
And the event "device.time" is a timestamp
And the exception "errorClass" equals "RuntimeError"
And the "file" of stack frame 0 equals "/usr/src/app/handled/notify_exception.rb"
And the "file" of stack frame 0 equals "handled/notify_exception.rb"
And the "lineNumber" of stack frame 0 equals 6

Scenario: A notified string sends a report
Expand All @@ -21,7 +21,7 @@ Scenario: A notified string sends a report
And the event "severityReason.type" equals "handledException"
And the event "device.time" is a timestamp
And the exception "errorClass" equals "RuntimeError"
And the "file" of the top non-bugsnag stackframe equals "/usr/src/app/handled/notify_string.rb"
And the "file" of the top non-bugsnag stackframe equals "handled/notify_string.rb"
And the "lineNumber" of the top non-bugsnag stackframe equals 8

Scenario: A handled error doesn't send a report when the :skip_bugsnag flag is set
Expand All @@ -36,7 +36,7 @@ Scenario: A handled error can attach metadata in a block
And the event "severity" equals "warning"
And the event "severityReason.type" equals "handledException"
And the exception "errorClass" equals "RuntimeError"
And the "file" of stack frame 0 equals "/usr/src/app/handled/block_metadata.rb"
And the "file" of stack frame 0 equals "handled/block_metadata.rb"
And the "lineNumber" of stack frame 0 equals 6
And the event "metaData.account.id" equals "1234abcd"
And the event "metaData.account.name" equals "Acme Co"
Expand Down
2 changes: 1 addition & 1 deletion features/plain_features/release_stages.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Scenario: Does notify in the correct release stage
And the event "severity" equals "error"
And the event "severityReason.type" equals "unhandledException"
And the exception "errorClass" equals "RuntimeError"
And the "file" of stack frame 0 equals "/usr/src/app/configuration/send_unhandled.rb"
And the "file" of stack frame 0 equals "configuration/send_unhandled.rb"
8 changes: 4 additions & 4 deletions features/plain_features/report_stack_frames.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Scenario Outline: Stack frames can be removed
When I run the service "plain-ruby" with the command "bundle exec ruby stack_frame_modification/remove_stack_frame.rb"
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the "file" of the top non-bugsnag stackframe equals "/usr/src/app/stack_frame_modification/initiators/<initiator>.rb"
And the "file" of the top non-bugsnag stackframe equals "stack_frame_modification/initiators/<initiator>.rb"
And the "lineNumber" of stack frame 0 equals <lineNumber>

Examples:
Expand All @@ -20,15 +20,15 @@ Scenario: Stack frames can be removed from a notified string
When I run the service "plain-ruby" with the command "bundle exec ruby stack_frame_modification/remove_stack_frame.rb"
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the "file" of the top non-bugsnag stackframe equals "/usr/src/app/stack_frame_modification/initiators/handled_block.rb"
And the "file" of the top non-bugsnag stackframe equals "stack_frame_modification/initiators/handled_block.rb"
And the "lineNumber" of the top non-bugsnag stackframe equals 19

Scenario Outline: Stack frames can be marked as in project
Given I set environment variable "CALLBACK_INITIATOR" to "<initiator>"
When I run the service "plain-ruby" with the command "bundle exec ruby stack_frame_modification/mark_frames_in_project.rb"
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the "file" of stack frame 0 equals "/usr/src/app/stack_frame_modification/initiators/<initiator>.rb"
And the "file" of stack frame 0 equals "stack_frame_modification/initiators/<initiator>.rb"
And the event "exceptions.0.stacktrace.0.inProject" is null
And the event "exceptions.0.stacktrace.1.inProject" is true
And the event "exceptions.0.stacktrace.2.inProject" is true
Expand All @@ -46,7 +46,7 @@ Scenario: Stack frames can be marked as in project with a handled string
And I run the service "plain-ruby" with the command "bundle exec ruby stack_frame_modification/mark_frames_in_project.rb"
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the "file" of the top non-bugsnag stackframe equals "/usr/src/app/stack_frame_modification/initiators/handled_block.rb"
And the "file" of the top non-bugsnag stackframe equals "stack_frame_modification/initiators/handled_block.rb"
And the event "exceptions.0.stacktrace.0.inProject" is null
And the event "exceptions.0.stacktrace.1.inProject" is true
And the event "exceptions.0.stacktrace.2.inProject" is true
Expand Down
4 changes: 2 additions & 2 deletions features/plain_features/unhandled_errors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Scenario Outline: An unhandled error sends a report
And the event "severityReason.type" equals "unhandledException"
And the event "device.time" is a timestamp
And the exception "errorClass" equals "<error>"
And the "file" of stack frame 0 equals "/usr/src/app/unhandled/<file>.rb"
And the "lineNumber" of stack frame 0 equals <lineNumber>
And the "file" of the first in-project stack frame equals "unhandled/<file>.rb"
And the "lineNumber" of the first in-project stack frame equals <lineNumber>

Examples:
| file | error | lineNumber | command |
Expand Down
2 changes: 1 addition & 1 deletion features/rails_features/before_notify.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Scenario: Rails before_notify controller method works on unhandled errors
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the exception "errorClass" equals "NameError"
And the exception "message" starts with "undefined local variable or method `generate_unhandled_error' for #<BeforeNotifyController"
And the exception "message" matches "^undefined local variable or method `generate_unhandled_error' for (#<|an instance of )BeforeNotifyController"
And the event "unhandled" is true
And the event "app.type" equals "rails"
And the event "metaData.request.url" ends with "/before_notify/unhandled"
Expand Down
2 changes: 1 addition & 1 deletion features/rails_features/handled.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Scenario: Thrown handled NameError
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the exception "errorClass" equals "NameError"
And the exception "message" starts with "undefined local variable or method `generate_unhandled_error' for #<HandledController"
And the exception "message" matches "^undefined local variable or method `generate_unhandled_error' for (#<|an instance of )HandledController"
And the event "unhandled" is false
And the event "metaData.request.url" ends with "/handled/thrown"
And the event "app.type" equals "rails"
Expand Down
2 changes: 1 addition & 1 deletion features/rails_features/on_error.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Scenario: Rails on_error works on unhandled errors
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the exception "errorClass" equals "NameError"
And the exception "message" starts with "undefined local variable or method `generate_unhandled_error' for #<UnhandledController"
And the exception "message" matches "^undefined local variable or method `generate_unhandled_error' for (#<|an instance of )UnhandledController"
And the event "unhandled" is true
And the event "app.type" equals "rails"
And the event "metaData.request.url" ends with "/unhandled/error"
Expand Down
4 changes: 2 additions & 2 deletions features/rails_features/request.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Scenario: Request data is collected automatically
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
And the exception "errorClass" equals "NameError"
And the exception "message" starts with "undefined local variable or method `generate_unhandled_error' for #<UnhandledController"
And the exception "message" matches "^undefined local variable or method `generate_unhandled_error' for (#<|an instance of )UnhandledController"
And the event "app.type" equals "rails"
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.headers.Host" is not null
Expand All @@ -33,7 +33,7 @@ Scenario: Request data can be modified in callbacks
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
And the exception "errorClass" equals "NameError"
And the exception "message" starts with "undefined local variable or method `generate_unhandled_error' for #<UnhandledController"
And the exception "message" matches "^undefined local variable or method `generate_unhandled_error' for (#<|an instance of )UnhandledController"
And the event "app.type" equals "rails"
And the event "metaData.request.something" equals "hello"
And the event "metaData.request.params.another_thing" equals "hi"
Expand Down
2 changes: 1 addition & 1 deletion features/rails_features/unhandled.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Scenario: Unhandled RuntimeError
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
And the exception "errorClass" equals "NameError"
And the exception "message" starts with "undefined local variable or method `generate_unhandled_error' for #<UnhandledController"
And the exception "message" matches "^undefined local variable or method `generate_unhandled_error' for (#<|an instance of )UnhandledController"
And the event "app.type" equals "rails"
And the event "metaData.request.url" ends with "/unhandled/error"
And the event "severity" equals "error"
Expand Down
15 changes: 15 additions & 0 deletions features/steps/ruby_notifier_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
}
end

Then(/^the "(.+)" of the first in-project stack frame equals (\d+|".+")$/) do |key, expected|
body = Maze::Server.errors.current[:body]
stacktrace = Maze::Helper.read_key_path(body, 'events.0.exceptions.0.stacktrace')

frame_index = stacktrace.find_index { |frame| frame["inProject"] == true }

if frame_index.nil?
raise "Unable to find an in-project stack frame in stacktrace: #{stacktrace.inspect}"
end

steps %Q{
the "#{key}" of stack frame #{frame_index} equals #{expected}
}
end

Then(/^the total sessionStarted count equals (\d+)$/) do |value|
body = Maze::Server.sessions.current[:body]
session_counts = Maze::Helper.read_key_path(body, "sessionCounts")
Expand Down
Loading