From 5afcbe03ead9ada87621888a31a62652b10a7e4f Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 20 Sep 2023 11:18:08 +0000 Subject: Add latest changes from gitlab-org/gitlab@16-4-stable-ee --- spec/tasks/gitlab/db_rake_spec.rb | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'spec/tasks/gitlab/db_rake_spec.rb') diff --git a/spec/tasks/gitlab/db_rake_spec.rb b/spec/tasks/gitlab/db_rake_spec.rb index 344429dc6ec..c35c162c99a 100644 --- a/spec/tasks/gitlab/db_rake_spec.rb +++ b/spec/tasks/gitlab/db_rake_spec.rb @@ -1,10 +1,9 @@ # frozen_string_literal: true -require 'spec_helper' -require 'rake' +require 'rake_helper' RSpec.describe 'gitlab:db namespace rake task', :silence_stdout, feature_category: :database do - before(:all) do # rubocop:disable RSpec/BeforeAll + before(:all) do Rake.application.rake_require 'active_record/railties/databases' Rake.application.rake_require 'tasks/seed_fu' Rake.application.rake_require 'tasks/gitlab/db' @@ -18,6 +17,7 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout, feature_categor allow(Rake::Task['db:migrate']).to receive(:invoke).and_return(true) allow(Rake::Task['db:schema:load']).to receive(:invoke).and_return(true) allow(Rake::Task['db:seed_fu']).to receive(:invoke).and_return(true) + stub_feature_flags(disallow_database_ddl_feature_flags: false) end describe 'mark_migration_complete' do @@ -551,9 +551,9 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout, feature_categor end describe 'clean_structure_sql' do - let_it_be(:clean_rake_task) { 'gitlab:db:clean_structure_sql' } - let_it_be(:test_task_name) { 'gitlab:db:_test_multiple_structure_cleans' } - let_it_be(:input) { 'this is structure data' } + let(:clean_rake_task) { 'gitlab:db:clean_structure_sql' } + let(:test_task_name) { 'gitlab:db:_test_multiple_structure_cleans' } + let(:input) { 'this is structure data' } let(:output) { StringIO.new } @@ -882,6 +882,16 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout, feature_categor end end + context 'when database ddl feature flag is enabled' do + it 'is a no-op' do + stub_feature_flags(disallow_database_ddl_feature_flags: true) + + expect(Gitlab::Database::AsyncIndexes).not_to receive(:execute_pending_actions!) + + expect { run_rake_task('gitlab:db:execute_async_index_operations:main') }.to raise_error(SystemExit) + end + end + context 'with geo configured' do before do skip_unless_geo_configured @@ -956,6 +966,16 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout, feature_categor end end + context 'when database ddl feature flag is enabled' do + it 'is a no-op' do + stub_feature_flags(disallow_database_ddl_feature_flags: true) + + expect(Gitlab::Database::AsyncConstraints).not_to receive(:validate_pending_entries!) + + expect { run_rake_task('gitlab:db:validate_async_constraints:main') }.to raise_error(SystemExit) + end + end + context 'with geo configured' do before do skip_unless_geo_configured -- cgit v1.2.3