Sha256: 28e399fa96179e7c01ff47a34274e3c5e18e0a148448613b3de07a0e3ff9b5d9

Contents?: true

Size: 696 Bytes

Versions: 46

Compression:

Stored size: 696 Bytes

Contents

require 'test_helper'

module Shipit
  class UniqueJobTest < ActiveSupport::TestCase
    test "the lock key contains the job type" do
      task = shipit_tasks(:shipit_restart)
      job_a = ChunkRollupJob.new(task)
      job_b = GithubSyncJob.new(task)

      called = false
      job_a.acquire_lock do
        job_b.acquire_lock do
          called = true
        end
      end
      assert called
    end

    test "the lock key is serialized" do
      task = shipit_tasks(:shipit_restart)
      job = ChunkRollupJob.new(task)
      key = %(Shipit::ChunkRollupJob-{"_aj_globalid"=>"gid://shipit/Shipit::Task/#{task.id}"})
      assert_equal key, job.lock_key(*job.arguments)
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
shipit-engine-0.31.0 test/jobs/unique_job_test.rb
shipit-engine-0.30.0 test/jobs/unique_job_test.rb
shipit-engine-0.29.0 test/jobs/unique_job_test.rb
shipit-engine-0.28.1 test/jobs/unique_job_test.rb
shipit-engine-0.28.0 test/jobs/unique_job_test.rb
shipit-engine-0.27.1 test/jobs/unique_job_test.rb
shipit-engine-0.27.0 test/jobs/unique_job_test.rb
shipit-engine-0.26.0 test/jobs/unique_job_test.rb
shipit-engine-0.25.1 test/jobs/unique_job_test.rb
shipit-engine-0.25.0 test/jobs/unique_job_test.rb
shipit-engine-0.24.0 test/jobs/unique_job_test.rb
shipit-engine-0.23.1 test/jobs/unique_job_test.rb
shipit-engine-0.23.0 test/jobs/unique_job_test.rb
shipit-engine-0.22.0 test/jobs/unique_job_test.rb
shipit-engine-0.21.0 test/jobs/unique_job_test.rb
shipit-engine-0.20.1 test/jobs/unique_job_test.rb
shipit-engine-0.20.0 test/jobs/unique_job_test.rb
shipit-engine-0.19.0 test/jobs/unique_job_test.rb
shipit-engine-0.18.1 test/jobs/unique_job_test.rb
shipit-engine-0.18.0 test/jobs/unique_job_test.rb