diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /spec/bin/sidekiq_cluster_spec.rb | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'spec/bin/sidekiq_cluster_spec.rb')
-rw-r--r-- | spec/bin/sidekiq_cluster_spec.rb | 31 |
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 |