2019-04-30 08:27:42 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-07-08 00:57:42 +08:00
|
|
|
require "rails_helper"
|
2019-02-14 09:22:40 +08:00
|
|
|
|
|
|
|
RSpec.describe Sidekiq::Pausable do
|
|
|
|
after do
|
2019-02-14 10:33:58 +08:00
|
|
|
Sidekiq.unpause_all!
|
2019-02-14 09:22:40 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it "can still run heartbeats when paused" do
|
|
|
|
Sidekiq.pause!
|
|
|
|
|
|
|
|
freeze_time 1.week.from_now
|
|
|
|
|
|
|
|
jobs = Sidekiq::ScheduledSet.new
|
|
|
|
jobs.clear
|
|
|
|
middleware = Sidekiq::Pausable.new
|
|
|
|
|
|
|
|
middleware.call(Jobs::RunHeartbeat.new, { "args" => [{}] }, "critical") do
|
|
|
|
"done"
|
|
|
|
end
|
|
|
|
|
|
|
|
jobs = Sidekiq::ScheduledSet.new
|
|
|
|
expect(jobs.size).to eq(0)
|
|
|
|
end
|
|
|
|
end
|