debian-mirror-gitlab/spec/bin/sidekiq_cluster_spec.rb

47 lines
1.4 KiB
Ruby
Raw Normal View History

2020-04-08 14:13:33 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-04-22 19:07:51 +05:30
require 'shellwords'
2020-04-08 14:13:33 +05:30
2020-06-23 00:09:42 +05:30
RSpec.describe 'bin/sidekiq-cluster' do
2020-04-08 14:13:33 +05:30
using RSpec::Parameterized::TableSyntax
context 'when selecting some queues and excluding others' do
where(:args, :included, :excluded) do
%w[--negate cronjob] | '-qdefault,1' | '-qcronjob,1'
2021-01-29 00:20:46 +05:30
%w[--queue-selector resource_boundary=cpu] | '-qupdate_merge_requests,1' | '-qdefault,1'
2020-04-08 14:13:33 +05:30
end
with_them do
it 'runs successfully', :aggregate_failures do
cmd = %w[bin/sidekiq-cluster --dryrun] + args
output, status = Gitlab::Popen.popen(cmd, Rails.root.to_s)
expect(status).to be(0)
2020-04-22 19:07:51 +05:30
expect(output).to include('bundle exec sidekiq')
expect(Shellwords.split(output)).to include(included)
expect(Shellwords.split(output)).not_to include(excluded)
2020-04-08 14:13:33 +05:30
end
end
end
context 'when selecting all queues' do
[
%w[*],
2021-09-04 01:27:46 +05:30
%w[--queue-selector *]
2020-04-08 14:13:33 +05:30
].each do |args|
it "runs successfully with `#{args}`", :aggregate_failures do
cmd = %w[bin/sidekiq-cluster --dryrun] + args
output, status = Gitlab::Popen.popen(cmd, Rails.root.to_s)
expect(status).to be(0)
2020-04-22 19:07:51 +05:30
expect(output).to include('bundle exec sidekiq')
expect(Shellwords.split(output)).to include('-qdefault,1')
expect(Shellwords.split(output)).to include('-qcronjob:ci_archive_traces_cron,1')
2020-04-08 14:13:33 +05:30
end
end
end
end