diff --git a/sentry-rails/spec/sentry/rails/tracing/active_storage_subscriber_spec.rb b/sentry-rails/spec/sentry/rails/tracing/active_storage_subscriber_spec.rb index 54b4eda9c..f41b379e1 100644 --- a/sentry-rails/spec/sentry/rails/tracing/active_storage_subscriber_spec.rb +++ b/sentry-rails/spec/sentry/rails/tracing/active_storage_subscriber_spec.rb @@ -2,7 +2,9 @@ require "spec_helper" -RSpec.describe Sentry::Rails::Tracing::ActiveStorageSubscriber, :subscriber, type: :request, skip: Rails.version.to_f <= 5.2 do +# Skipped on JRuby because it's very flaky there due to shelling out to use imagemagick CLI +RSpec.describe Sentry::Rails::Tracing::ActiveStorageSubscriber, :subscriber, type: :request, + skip: Rails.version.to_f <= 5.2 || RUBY_PLATFORM == "java" do let(:transport) do Sentry.get_current_client.transport end diff --git a/sentry-rails/spec/sentry/rails/tracing_spec.rb b/sentry-rails/spec/sentry/rails/tracing_spec.rb index 1adf2d7fb..65988bc88 100644 --- a/sentry-rails/spec/sentry/rails/tracing_spec.rb +++ b/sentry-rails/spec/sentry/rails/tracing_spec.rb @@ -52,11 +52,9 @@ expect(second_span[:description]).to eq("SELECT \"posts\".* FROM \"posts\"") expect(second_span[:parent_span_id]).to eq(first_span[:span_id]) - # this is to make sure we calculate the timestamp in the correct scale (second instead of millisecond) - # Use more relaxed bounds for JRuby compatibility - min_duration = 10.0 / 1_000_000 # 10 microseconds - max_duration = RUBY_PLATFORM == "java" ? 50.0 / 1000 : 10.0 / 1000 # 50ms for JRuby, 10ms for others - expect(second_span[:timestamp] - second_span[:start_timestamp]).to be_between(min_duration, max_duration) + expect(second_span[:timestamp] - second_span[:start_timestamp]).to be > 0 + expect(second_span[:start_timestamp]).to be >= transaction[:start_timestamp] + expect(second_span[:timestamp]).to be <= transaction[:timestamp] end it "records transaction alone" do @@ -91,11 +89,9 @@ ) expect(second_span[:parent_span_id]).to eq(first_span[:span_id]) - # this is to make sure we calculate the timestamp in the correct scale (second instead of millisecond) - # Use more relaxed bounds for JRuby compatibility - min_duration = 10.0 / 1_000_000 # 10 microseconds - max_duration = RUBY_PLATFORM == "java" ? 50.0 / 1000 : 10.0 / 1000 # 50ms for JRuby, 10ms for others - expect(second_span[:timestamp] - second_span[:start_timestamp]).to be_between(min_duration, max_duration) + expect(second_span[:timestamp] - second_span[:start_timestamp]).to be > 0 + expect(second_span[:start_timestamp]).to be >= transaction[:start_timestamp] + expect(second_span[:timestamp]).to be <= transaction[:timestamp] third_span = transaction[:spans][2] expect(third_span[:op]).to eq("template.render_template.action_view")