Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-15 21:10:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-15 21:10:06 +0300
commitb07852468f800d751ddecc9e327119d7295f538e (patch)
treed1169f95ea3725d609c796a1ca87d5766646852c /spec/tasks
parent0ff373dc416216d02760c7c162ee23382eb1f4a3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/tasks')
-rw-r--r--spec/tasks/gitlab/db_rake_spec.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/tasks/gitlab/db_rake_spec.rb b/spec/tasks/gitlab/db_rake_spec.rb
index cdff5577157..edfdb44022b 100644
--- a/spec/tasks/gitlab/db_rake_spec.rb
+++ b/spec/tasks/gitlab/db_rake_spec.rb
@@ -246,17 +246,25 @@ RSpec.describe 'gitlab:db namespace rake task' do
context 'with index name given' do
let(:index) { double('index') }
+ before do
+ allow(Gitlab::Database::Reindexing).to receive(:candidate_indexes).and_return(indexes)
+ end
+
it 'calls the index rebuilder with the proper arguments' do
- expect(Gitlab::Database::PostgresIndex).to receive(:by_identifier).with('public.foo_idx').and_return(index)
+ allow(indexes).to receive(:where).with(identifier: 'public.foo_idx').and_return([index])
expect(Gitlab::Database::Reindexing).to receive(:perform).with([index])
run_rake_task('gitlab:db:reindex', '[public.foo_idx]')
end
it 'raises an error if the index does not exist' do
- expect(Gitlab::Database::PostgresIndex).to receive(:by_identifier).with('public.absent_index').and_raise(ActiveRecord::RecordNotFound)
+ allow(indexes).to receive(:where).with(identifier: 'public.absent_index').and_return([])
+
+ expect { run_rake_task('gitlab:db:reindex', '[public.absent_index]') }.to raise_error(/Index not found/)
+ end
- expect { run_rake_task('gitlab:db:reindex', '[public.absent_index]') }.to raise_error(ActiveRecord::RecordNotFound)
+ it 'raises an error if the index is not fully qualified with a schema' do
+ expect { run_rake_task('gitlab:db:reindex', '[foo_idx]') }.to raise_error(/Index name is not fully qualified/)
end
end
end