Commit d8487777 authored by Stan Hu's avatar Stan Hu

Address review comments for Geo spec

parent 9c03ebd6
......@@ -83,18 +83,18 @@ module Gitlab
end
def self.configure_primary_jobs!
PRIMARY_JOBS.map { |job| self.send(job).try(:enable!) }
SECONDARY_JOBS.map { |job| self.send(job).try(:disable!) }
PRIMARY_JOBS.each { |job| self.send(job).try(:enable!) }
SECONDARY_JOBS.each { |job| self.send(job).try(:disable!) }
end
def self.configure_secondary_jobs!
PRIMARY_JOBS.map { |job| self.send(job).try(:disable!) }
SECONDARY_JOBS.map { |job| self.send(job).try(:enable!) }
PRIMARY_JOBS.each { |job| self.send(job).try(:disable!) }
SECONDARY_JOBS.each { |job| self.send(job).try(:enable!) }
end
def self.disable_all_jobs!
PRIMARY_JOBS.map { |job| self.send(job).try(:disable!) }
SECONDARY_JOBS.map { |job| self.send(job).try(:disable!) }
PRIMARY_JOBS.each { |job| self.send(job).try(:disable!) }
SECONDARY_JOBS.each { |job| self.send(job).try(:disable!) }
end
def self.configure_cron_jobs!
......
......@@ -133,26 +133,26 @@ describe Gitlab::Geo, lib: true do
allow(described_class).to receive(:primary?).and_return(true)
described_class.configure_cron_jobs!
expect(described_class.bulk_notify_job.enabled?).to be_truthy
expect(described_class.backfill_job.enabled?).to be_falsey
expect(described_class.file_download_job.enabled?).to be_falsey
expect(described_class.bulk_notify_job).to be_enabled
expect(described_class.backfill_job).not_to be_enabled
expect(described_class.file_download_job).not_to be_enabled
end
it 'activates cron jobs for secondary' do
allow(described_class).to receive(:secondary?).and_return(true)
described_class.configure_cron_jobs!
expect(described_class.bulk_notify_job.enabled?).to be_falsey
expect(described_class.backfill_job.enabled?).to be_truthy
expect(described_class.file_download_job.enabled?).to be_truthy
expect(described_class.bulk_notify_job).not_to be_enabled
expect(described_class.backfill_job).to be_enabled
expect(described_class.file_download_job).to be_enabled
end
it 'deactivates all jobs when Geo is not active' do
described_class.configure_cron_jobs!
expect(described_class.bulk_notify_job.enabled?).to be_falsey
expect(described_class.backfill_job.enabled?).to be_falsey
expect(described_class.file_download_job.enabled?).to be_falsey
expect(described_class.bulk_notify_job).not_to be_enabled
expect(described_class.backfill_job).not_to be_enabled
expect(described_class.file_download_job).not_to be_enabled
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment