Skip to content

Supress expected warning for test suite #604

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

Merged
merged 2 commits into from
Jul 22, 2025
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
2 changes: 2 additions & 0 deletions test/dummy/app/jobs/infinite_recursion_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ class InfiniteRecursionJob < ApplicationJob

def perform
start
rescue SystemStackError => e
raise ExpectedTestError, "stack level too deep", e.backtrace
end

private
Expand Down
11 changes: 5 additions & 6 deletions test/models/solid_queue/failed_execution_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ class SolidQueue::FailedExecutionTest < ActiveSupport::TestCase
end

test "run job that fails with a SystemStackError (stack level too deep)" do
silence_on_thread_error_for(SystemStackError) do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we were already trying to do this, but with no success.

From my research, only exceptions who do not inherit StandardError are being logged.

ExpectedTestError inherits RuntimeError which inherits StandardError.

The problem with SystemStackError is that it inherits Exception - not StandardError - which leaks a log. Not 100% sure why though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh yes! I had forgotten we were trying to do this here, because it didn't work 😅

InfiniteRecursionJob.perform_later
@worker.start
InfiniteRecursionJob.perform_later
@worker.start

assert_equal 1, SolidQueue::FailedExecution.count
assert SolidQueue::Job.last.failed?
end
assert_equal 1, SolidQueue::FailedExecution.count
assert SolidQueue::Job.last.failed?
assert_equal "stack level too deep", SolidQueue::FailedExecution.last.message
end

test "retry failed job" do
Expand Down