Skip to content

Commit

Permalink
Add test to demonstrate enqueuing within a connected_to block
Browse files Browse the repository at this point in the history
  • Loading branch information
rosa committed Dec 6, 2024
1 parent a881928 commit 8c4beb9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/models/solid_queue/job_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ class NonOverlappingGroupedJob2 < NonOverlappingJob
assert_equal solid_queue_job.scheduled_at, execution.scheduled_at
end

test "enqueue jobs within a connected_to block for the primary DB" do
ShardedRecord.connected_to(role: :writing, shard: :shard_two) do
ShardedJobResult.create!(value: "in shard two")
AddToBufferJob.perform_later("enqueued within block")
end

job = SolidQueue::Job.last
assert_equal "enqueued within block", job.arguments.dig("arguments", 0)
end

test "enqueue jobs without concurrency controls" do
active_job = AddToBufferJob.perform_later(1)
assert_nil active_job.concurrency_limit
Expand Down

0 comments on commit 8c4beb9

Please sign in to comment.