diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-30 21:11:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-30 21:11:38 +0300 |
commit | 4534d890f1e1d198804e9e2ff0da76e2308ebe23 (patch) | |
tree | 3538a50326d2fd52dd1545cc0a387e24a2877fe4 /spec/tasks/gitlab | |
parent | d0713b807555cbd970ce712d5c0812daee371e2b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/tasks/gitlab')
-rw-r--r-- | spec/tasks/gitlab/db/decomposition/migrate_rake_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/tasks/gitlab/db/decomposition/migrate_rake_spec.rb b/spec/tasks/gitlab/db/decomposition/migrate_rake_spec.rb new file mode 100644 index 00000000000..300c7009154 --- /dev/null +++ b/spec/tasks/gitlab/db/decomposition/migrate_rake_spec.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'gitlab:db:decomposition:migrate', feature_category: :cell do + before(:all) do + skip_if_database_exists(:ci) + + Rake.application.rake_require 'tasks/gitlab/db/decomposition/migrate' + end + + subject(:migrate_task) { run_rake_task('gitlab:db:decomposition:migrate') } + + before do + allow_next_instance_of(Gitlab::Database::Decomposition::Migrate) do |instance| + allow(instance).to receive(:process!) + end + end + + it 'calls Gitlab::Database::Decomposition::Migrate#process!' do + expect_next_instance_of(Gitlab::Database::Decomposition::Migrate) do |instance| + expect(instance).to receive(:process!) + end + + migrate_task + end + + context 'when a Gitlab::Database::Decomposition::Migrate::Error is raised' do + before do + allow_next_instance_of(Gitlab::Database::Decomposition::Migrate) do |instance| + allow(instance).to receive(:process!).and_raise(Gitlab::Database::Decomposition::MigrateError, 'some error') + end + end + + it 'renders error' do + expect { migrate_task }.to output("some error\n").to_stdout.and raise_error(SystemExit) + end + end +end |