From 7e9c479f7de77702622631cff2628a9c8dcbc627 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 19 Nov 2020 08:27:35 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-6-stable-ee --- spec/bin/feature_flag_spec.rb | 29 ++++++++++++++++++++++++++--- spec/bin/sidekiq_cluster_spec.rb | 4 ++++ 2 files changed, 30 insertions(+), 3 deletions(-) (limited to 'spec/bin') diff --git a/spec/bin/feature_flag_spec.rb b/spec/bin/feature_flag_spec.rb index 185a03fc587..710b1606923 100644 --- a/spec/bin/feature_flag_spec.rb +++ b/spec/bin/feature_flag_spec.rb @@ -13,7 +13,7 @@ RSpec.describe 'bin/feature-flag' do let(:options) { FeatureFlagOptionParser.parse(argv) } let(:creator) { described_class.new(options) } let(:existing_flags) do - { 'existing-feature-flag' => File.join('config', 'feature_flags', 'development', 'existing-feature-flag.yml') } + { 'existing_feature_flag' => File.join('config', 'feature_flags', 'development', 'existing_feature_flag.yml') } end before do @@ -32,12 +32,12 @@ RSpec.describe 'bin/feature-flag' do it 'properly creates a feature flag' do expect(File).to receive(:write).with( - File.join('config', 'feature_flags', 'development', 'feature-flag-name.yml'), + File.join('config', 'feature_flags', 'development', 'feature_flag_name.yml'), anything) expect do subject - end.to output(/name: feature-flag-name/).to_stdout + end.to output(/name: feature_flag_name/).to_stdout end context 'when running on master' do @@ -123,6 +123,29 @@ RSpec.describe 'bin/feature-flag' do end end + context 'when there is deprecated feature flag type' do + before do + stub_const('FeatureFlagOptionParser::TYPES', + development: { description: 'short' }, + deprecated: { description: 'deprecated', deprecated: true } + ) + end + + context 'and deprecated type is given' do + let(:type) { 'deprecated' } + + it 'shows error message and retries' do + expect($stdin).to receive(:gets).and_return(type) + expect($stdin).to receive(:gets).and_raise('EOF') + + expect do + expect { described_class.read_type }.to raise_error(/EOF/) + end.to output(/Specify the feature flag type/).to_stdout + .and output(/Invalid type specified/).to_stderr + end + end + end + context 'when there are many types defined' do before do stub_const('FeatureFlagOptionParser::TYPES', diff --git a/spec/bin/sidekiq_cluster_spec.rb b/spec/bin/sidekiq_cluster_spec.rb index fc5e2ae861a..503cc0999c5 100644 --- a/spec/bin/sidekiq_cluster_spec.rb +++ b/spec/bin/sidekiq_cluster_spec.rb @@ -9,6 +9,8 @@ RSpec.describe 'bin/sidekiq-cluster' do context 'when selecting some queues and excluding others' do where(:args, :included, :excluded) do %w[--negate cronjob] | '-qdefault,1' | '-qcronjob,1' + %w[--queue-selector resource_boundary=cpu] | '-qupdate_merge_requests,1' | '-qdefault,1' + # Remove with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646 %w[--experimental-queue-selector resource_boundary=cpu] | '-qupdate_merge_requests,1' | '-qdefault,1' end @@ -29,6 +31,8 @@ RSpec.describe 'bin/sidekiq-cluster' do context 'when selecting all queues' do [ %w[*], + %w[--queue-selector *], + # Remove with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646 %w[--experimental-queue-selector *] ].each do |args| it "runs successfully with `#{args}`", :aggregate_failures do -- cgit v1.2.1