diff --git a/.github/workflows/sentry_rails_test.yml b/.github/workflows/sentry_rails_test.yml index ed32ab477..06a5867c0 100644 --- a/.github/workflows/sentry_rails_test.yml +++ b/.github/workflows/sentry_rails_test.yml @@ -51,6 +51,8 @@ jobs: - { ruby_version: "3.1", rails_version: 7.2.0 } - { ruby_version: "3.2", rails_version: 7.2.0 } - { ruby_version: "3.3", rails_version: 7.2.0 } + - { ruby_version: "3.2", rails_version: "8.0.0.rc1" } + - { ruby_version: "3.3", rails_version: "8.0.0.rc1" } - { ruby_version: "jruby", rails_version: 6.1.0 } - { ruby_version: "3.2", diff --git a/sentry-rails/Gemfile b/sentry-rails/Gemfile index 7695eff15..53f632539 100644 --- a/sentry-rails/Gemfile +++ b/sentry-rails/Gemfile @@ -12,40 +12,38 @@ platform :jruby do gem "jdbc-sqlite3" end +ruby_version = Gem::Version.new(RUBY_VERSION) + rails_version = ENV["RAILS_VERSION"] -rails_version = "7.1.0" if rails_version.nil? +rails_version = "7.2.0" if rails_version.nil? rails_version = Gem::Version.new(rails_version) -if rails_version < Gem::Version.new("6.0.0") - gem "sqlite3", "~> 1.3.0", platform: :ruby -else - if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.0") - gem "sqlite3", "~> 1.7.3", platform: :ruby - else - gem "sqlite3", "~> 1.6.9", platform: :ruby - end -end +gem "rails", "~> #{rails_version}" if rails_version >= Gem::Version.new("8.0.0.alpha") - gem "rails", github: "rails/rails" gem "rspec-rails" + gem "sqlite3", platform: :ruby elsif rails_version >= Gem::Version.new("7.1.0") - gem "rails", "~> #{rails_version}" gem "rspec-rails" + gem "sqlite3", "~> 1.7.3", platform: :ruby +elsif rails_version >= Gem::Version.new("6.1.0") + gem "rspec-rails", "~> 4.0" + + if ruby_version >= Gem::Version.new("2.7.0") + gem "sqlite3", "~> 1.7.3", platform: :ruby + else + gem "sqlite3", "~> 1.6.9", platform: :ruby + end else gem "rspec-rails", "~> 4.0" - gem "rails", "~> #{rails_version}" gem "psych", "~> 3.0.0" -end -gem "mini_magick" - -gem "sprockets-rails" - -gem "sidekiq" - - -ruby_version = Gem::Version.new(RUBY_VERSION) + if rails_version >= Gem::Version.new("6.0.0") + gem "sqlite3", "~> 1.4.0", platform: :ruby + else + gem "sqlite3", "~> 1.3.0", platform: :ruby + end +end if ruby_version < Gem::Version.new("2.5.0") # https://github.com/flavorjones/loofah/pull/267 @@ -53,6 +51,10 @@ if ruby_version < Gem::Version.new("2.5.0") gem "loofah", "2.20.0" end +gem "mini_magick" + +gem "sprockets-rails" + gem "benchmark-ips" gem "benchmark_driver" gem "benchmark-ipsa" diff --git a/sentry-rails/spec/sentry/rails/activejob_spec.rb b/sentry-rails/spec/sentry/rails/activejob_spec.rb index 9e9e0ce36..cf986d937 100644 --- a/sentry-rails/spec/sentry/rails/activejob_spec.rb +++ b/sentry-rails/spec/sentry/rails/activejob_spec.rb @@ -309,21 +309,17 @@ def perform(event, hint) context "when we are using an adapter which has a specific integration" do before do - Sentry.configuration.rails.skippable_job_adapters = ["ActiveJob::QueueAdapters::SidekiqAdapter"] + Sentry.configuration.rails.skippable_job_adapters = ["ActiveJob::QueueAdapters::TestAdapter"] end - it "does not trigger sentry and re-raises" do - begin - original_queue_adapter = FailedJob.queue_adapter - FailedJob.queue_adapter = :sidekiq + after do + Sentry.configuration.rails.skippable_job_adapters = [] + end - expect { FailedJob.perform_now }.to raise_error(FailedJob::TestError) + it "does not trigger sentry and re-raises" do + expect { FailedJob.perform_now }.to raise_error(FailedJob::TestError) - expect(transport.events.size).to eq(0) - ensure - # this doesn't affect test result, but we shouldn't change it anyway - FailedJob.queue_adapter = original_queue_adapter - end + expect(transport.events.size).to eq(0) end end diff --git a/sentry-rails/spec/sentry/rails/tracing/active_support_subscriber_spec.rb b/sentry-rails/spec/sentry/rails/tracing/active_support_subscriber_spec.rb index 951ebb212..c276063da 100644 --- a/sentry-rails/spec/sentry/rails/tracing/active_support_subscriber_spec.rb +++ b/sentry-rails/spec/sentry/rails/tracing/active_support_subscriber_spec.rb @@ -47,12 +47,11 @@ expect(transport.events.count).to eq(1) cache_transaction = transport.events.first.to_hash expect(cache_transaction[:type]).to eq("transaction") - expect(cache_transaction[:spans].count).to eq(2) - expect(cache_transaction[:spans][1][:op]).to eq("cache.put") - expect(cache_transaction[:spans][1][:origin]).to eq("auto.cache.rails") + expect(cache_transaction[:spans].count).to eq(1) + expect(cache_transaction[:spans][0][:op]).to eq("cache.put") + expect(cache_transaction[:spans][0][:origin]).to eq("auto.cache.rails") end - # it "tracks cache decrement" do skip("Tracks on Rails 8.0 for all Cache Stores; Until then only MemCached and Redis Stores.") if Rails.version.to_f < 8.0 @@ -67,9 +66,9 @@ expect(transport.events.count).to eq(1) cache_transaction = transport.events.first.to_hash expect(cache_transaction[:type]).to eq("transaction") - expect(cache_transaction[:spans].count).to eq(2) - expect(cache_transaction[:spans][1][:op]).to eq("cache.put") - expect(cache_transaction[:spans][1][:origin]).to eq("auto.cache.rails") + expect(cache_transaction[:spans].count).to eq(1) + expect(cache_transaction[:spans][0][:op]).to eq("cache.put") + expect(cache_transaction[:spans][0][:origin]).to eq("auto.cache.rails") end it "tracks cache read" do