diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-22 15:08:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-22 15:08:40 +0300 |
commit | be3e24ea3c9f497efde85900df298ce9bc42fce8 (patch) | |
tree | fd0de9443253a1b21ca9a2741dc34ba3aef795be /spec/lib/gitlab/sidekiq_config_spec.rb | |
parent | 001243986195143c395a9811d8254bbf1b9ebfa1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/sidekiq_config_spec.rb')
-rw-r--r-- | spec/lib/gitlab/sidekiq_config_spec.rb | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/spec/lib/gitlab/sidekiq_config_spec.rb b/spec/lib/gitlab/sidekiq_config_spec.rb index 49efbac160a..39bb149cf73 100644 --- a/spec/lib/gitlab/sidekiq_config_spec.rb +++ b/spec/lib/gitlab/sidekiq_config_spec.rb @@ -5,10 +5,10 @@ require 'spec_helper' describe Gitlab::SidekiqConfig do describe '.workers' do it 'includes all workers' do - workers = described_class.workers + worker_classes = described_class.workers.map(&:klass) - expect(workers).to include(PostReceive) - expect(workers).to include(MergeWorker) + expect(worker_classes).to include(PostReceive) + expect(worker_classes).to include(MergeWorker) end end @@ -44,4 +44,40 @@ describe Gitlab::SidekiqConfig do expect(queues).to include('unknown') end end + + describe '.workers_for_all_queues_yml' do + it 'returns a tuple with FOSS workers first' do + expect(described_class.workers_for_all_queues_yml.first) + .to include(an_object_having_attributes(queue: 'post_receive')) + end + end + + describe '.all_queues_yml_outdated?' do + before do + workers = [ + PostReceive, + MergeWorker, + ProcessCommitWorker + ].map { |worker| described_class::Worker.new(worker, ee: false) } + + allow(described_class).to receive(:workers).and_return(workers) + allow(Gitlab).to receive(:ee?).and_return(false) + end + + it 'returns true if the YAML file does not match the application code' do + allow(File).to receive(:read) + .with(described_class::FOSS_QUEUE_CONFIG_PATH) + .and_return(YAML.dump(%w[post_receive merge])) + + expect(described_class.all_queues_yml_outdated?).to be(true) + end + + it 'returns false if the YAML file matches the application code' do + allow(File).to receive(:read) + .with(described_class::FOSS_QUEUE_CONFIG_PATH) + .and_return(YAML.dump(%w[merge post_receive process_commit])) + + expect(described_class.all_queues_yml_outdated?).to be(false) + end + end end |