Skip to content

Commit 36920ac

Browse files
authored
Fix test failures under jruby (#2665)
* Fix test failures under jruby * Fix flaky thread interface spec * Remove jruby/rails-6.1 from matrix jruby is now 3.4 and that version no longer works with rails 6.x furthermore, jruby is not yet compatible with rails 7.1 and 8.0.
1 parent 5d9c338 commit 36920ac

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

.github/workflows/sentry_rails_test.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ jobs:
8181
rails_version: "8.0.0"
8282
- ruby_version: "3.4"
8383
rails_version: "8.0.0"
84-
- ruby_version: "jruby"
85-
rails_version: 6.1.0
8684
- ruby_version: "3.2"
8785
rails_version: 7.1.0
8886
options:

sentry-ruby/spec/sentry/client_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,10 @@ def sentry_context
201201
event = nil
202202

203203
t = Thread.new do
204+
Thread.current.name = "Thread 1"
204205
event = subject.event_from_message(message)
205206
end
206207

207-
t.name = "Thread 1"
208208
t.join
209209
hash = event.to_hash
210210

@@ -321,15 +321,15 @@ def sentry_context
321321
version = Gem::Version.new(RUBY_VERSION)
322322

323323
case
324-
when version >= Gem::Version.new("3.4.0-dev")
324+
when version >= Gem::Version.new("3.4.0-dev") && RUBY_ENGINE == "ruby"
325325
expect(hash[:exception][:values][0][:value]).to eq(
326326
"undefined method '[]' for nil (NoMethodError)\n\n {}[:foo][:bar]\n ^^^^^^"
327327
)
328-
when version >= Gem::Version.new("3.3.0-dev")
328+
when version >= Gem::Version.new("3.3.0-dev") && RUBY_ENGINE == "ruby"
329329
expect(hash[:exception][:values][0][:value]).to eq(
330330
"undefined method `[]' for nil (NoMethodError)\n\n {}[:foo][:bar]\n ^^^^^^"
331331
)
332-
when version >= Gem::Version.new("3.2")
332+
when version >= Gem::Version.new("3.2") && RUBY_ENGINE == "ruby"
333333
expect(hash[:exception][:values][0][:value]).to eq(
334334
"undefined method `[]' for nil:NilClass (NoMethodError)\n\n {}[:foo][:bar]\n ^^^^^^"
335335
)
@@ -365,10 +365,10 @@ def detailed_message(*)
365365
event = nil
366366

367367
t = Thread.new do
368+
Thread.current.name = "Thread 1"
368369
event = subject.event_from_exception(exception)
369370
end
370371

371-
t.name = "Thread 1"
372372
t.join
373373

374374
event_hash = event.to_hash

sentry-ruby/spec/sentry/vernier/profiler_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require "sentry/vernier/profiler"
44

5-
RSpec.describe Sentry::Vernier::Profiler, when: { ruby_version?: [:>=, "3.3"] } do
5+
RSpec.describe Sentry::Vernier::Profiler, when: { ruby_version?: [:>=, "3.3"], ruby_engine?: "ruby" } do
66
subject(:profiler) { described_class.new(Sentry.configuration) }
77

88
before do
@@ -264,7 +264,7 @@
264264
expect(thread2[:name]).to eq("thread-bar-1")
265265
end
266266

267-
it 'has correct frames', when: { ruby_version?: [:>=, "3.3"] } do
267+
it 'has correct frames', when: { ruby_version?: [:>=, "3.3"], ruby_engine?: "ruby" } do
268268
frames = profiler.to_hash[:profile][:frames]
269269

270270
foo_frame = frames.find { |f| f[:function] =~ /foo/ }
@@ -277,7 +277,7 @@
277277
expect(foo_frame[:abs_path]).to include('sentry-ruby/spec/support/profiler.rb')
278278
end
279279

280-
it 'has correct stacks', when: { ruby_version?: [:>=, "3.3"] } do
280+
it 'has correct stacks', when: { ruby_version?: [:>=, "3.3"], ruby_engine?: "ruby" } do
281281
profile = profiler.to_hash[:profile]
282282
frames = profile[:frames]
283283
stacks = profile[:stacks]

0 commit comments

Comments
 (0)