diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
commit | 5afcbe03ead9ada87621888a31a62652b10a7e4f (patch) | |
tree | 9918b67a0d0f0bafa6542e839a8be37adf73102d /spec/tasks/gitlab/db_rake_spec.rb | |
parent | c97c0201564848c1f53226fe19d71fdcc472f7d0 (diff) |
Add latest changes from gitlab-org/gitlab@16-4-stable-eev16.4.0-rc42
Diffstat (limited to 'spec/tasks/gitlab/db_rake_spec.rb')
-rw-r--r-- | spec/tasks/gitlab/db_rake_spec.rb | 32 |
1 files changed, 26 insertions, 6 deletions
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 |