Skip to content

Commit 8d82440

Browse files
committed
Add a test for the provision of provider_job_id within job execution environment
1 parent a0ab547 commit 8d82440

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class ProviderJobIdJob < ApplicationJob
2+
def perform
3+
JobBuffer.add "provider_job_id: #{provider_job_id}"
4+
end
5+
end

test/models/solid_queue/claimed_execution_test.rb

+8
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ class SolidQueue::ClaimedExecutionTest < ActiveSupport::TestCase
7373
assert job.reload.failed?
7474
end
7575

76+
test "provider_job_id is available within job execution" do
77+
job = ProviderJobIdJob.perform_later
78+
claimed_execution = prepare_and_claim_job job
79+
claimed_execution.perform
80+
81+
assert_equal "provider_job_id: #{job.provider_job_id}", JobBuffer.last_value
82+
end
83+
7684
private
7785
def prepare_and_claim_job(active_job, process: @process)
7886
job = SolidQueue::Job.find_by(active_job_id: active_job.job_id)

0 commit comments

Comments
 (0)