Skip to content

Conversation

@p-schlickmann
Copy link

@p-schlickmann p-schlickmann commented Nov 12, 2025

Following up our discussion at rails#142

These are some minimal improvements to the organization of the tests. Very great work with the batches @jpcamara !

ApplicationJob.enqueue_after_transaction_commit = false if defined?(ApplicationJob.enqueue_after_transaction_commit)
SolidQueue.preserve_finished_jobs = true
SolidQueue::Batch.maintenance_queue_name = nil
end
Copy link
Author

Choose a reason for hiding this comment

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

these removals in setup and teardown are happening because this is already being handled either in test_helper.rb or by the use of transactional tests

JobBuffer.add "Hi failure #{batch.id}!"
end
end

Copy link
Author

Choose a reason for hiding this comment

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

just moving those jobs from the bottom to the top of the file

def job!(active_job)
SolidQueue::Job.find_by!(active_job_id: active_job.job_id)
skip_active_record_query_cache do
SolidQueue::Job.find_by!(active_job_id: active_job.job_id)
Copy link
Author

Choose a reason for hiding this comment

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

this should be fine but I just wanted to make sure we are skipping active record query cache, as we do in other tests


class SolidQueue::BatchTest < ActiveSupport::TestCase
self.use_transactional_tests = false
class BatchCompletionJob < ApplicationJob
Copy link
Author

Choose a reason for hiding this comment

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

I moved BatchCompletionJob here instead of a separate file, since it's only being used in this test

Copy link
Author

Choose a reason for hiding this comment

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

wasn't being used anywhere

Copy link
Author

@p-schlickmann p-schlickmann Nov 12, 2025

Choose a reason for hiding this comment

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

moved to test/models/solid_queue/batch_test.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant