Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 6 additions & 10 deletions sentry-rails/spec/sentry/rails/tracing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
Loading