Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/bin/sidekiq_cluster_spec.rb')
-rw-r--r--spec/bin/sidekiq_cluster_spec.rb31
1 files changed, 25 insertions, 6 deletions
diff --git a/spec/bin/sidekiq_cluster_spec.rb b/spec/bin/sidekiq_cluster_spec.rb
index 1bba048a27c..eb014c511e3 100644
--- a/spec/bin/sidekiq_cluster_spec.rb
+++ b/spec/bin/sidekiq_cluster_spec.rb
@@ -1,11 +1,14 @@
# frozen_string_literal: true
-require 'spec_helper'
+require 'fast_spec_helper'
require 'shellwords'
+require 'rspec-parameterized'
-RSpec.describe 'bin/sidekiq-cluster' do
+RSpec.describe 'bin/sidekiq-cluster', :aggregate_failures do
using RSpec::Parameterized::TableSyntax
+ let(:root) { File.expand_path('../..', __dir__) }
+
context 'when selecting some queues and excluding others' do
where(:args, :included, :excluded) do
%w[--negate cronjob] | '-qdefault,1' | '-qcronjob,1'
@@ -13,10 +16,10 @@ RSpec.describe 'bin/sidekiq-cluster' do
end
with_them do
- it 'runs successfully', :aggregate_failures do
+ it 'runs successfully' do
cmd = %w[bin/sidekiq-cluster --dryrun] + args
- output, status = Gitlab::Popen.popen(cmd, Rails.root.to_s)
+ output, status = Gitlab::Popen.popen(cmd, root)
expect(status).to be(0)
expect(output).to include('bundle exec sidekiq')
@@ -31,10 +34,10 @@ RSpec.describe 'bin/sidekiq-cluster' do
%w[*],
%w[--queue-selector *]
].each do |args|
- it "runs successfully with `#{args}`", :aggregate_failures do
+ it "runs successfully with `#{args}`" do
cmd = %w[bin/sidekiq-cluster --dryrun] + args
- output, status = Gitlab::Popen.popen(cmd, Rails.root.to_s)
+ output, status = Gitlab::Popen.popen(cmd, root)
expect(status).to be(0)
expect(output).to include('bundle exec sidekiq')
@@ -43,4 +46,20 @@ RSpec.describe 'bin/sidekiq-cluster' do
end
end
end
+
+ context 'when arguments contain newlines' do
+ it 'raises an error' do
+ [
+ ["default\n"],
+ ["defaul\nt"]
+ ].each do |args|
+ cmd = %w[bin/sidekiq-cluster --dryrun] + args
+
+ output, status = Gitlab::Popen.popen(cmd, root)
+
+ expect(status).to be(1)
+ expect(output).to include('cannot contain newlines')
+ end
+ end
+ end
end