summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/database/batch_count_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 03:09:15 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 03:09:15 +0000
commit7ba5b9babaa5802c39e686c57cbf4a3f4725c4b0 (patch)
tree03a696c26f32e46faa46dd12d0a937d1d0d1cba4 /spec/lib/gitlab/database/batch_count_spec.rb
parentb56027c9d80ac0e297ba8a43c81e8504172dbf9f (diff)
downloadgitlab-ce-7ba5b9babaa5802c39e686c57cbf4a3f4725c4b0.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/database/batch_count_spec.rb')
-rw-r--r--spec/lib/gitlab/database/batch_count_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database/batch_count_spec.rb b/spec/lib/gitlab/database/batch_count_spec.rb
index ec161cd6dcb..7842323d009 100644
--- a/spec/lib/gitlab/database/batch_count_spec.rb
+++ b/spec/lib/gitlab/database/batch_count_spec.rb
@@ -49,6 +49,12 @@ describe Gitlab::Database::BatchCount do
[1, 2, 4, 5, 6].each { |i| expect(described_class.batch_count(model, batch_size: i)).to eq(5) }
end
+ it 'will raise an error if distinct count is requested' do
+ expect do
+ described_class.batch_count(model.distinct(column))
+ end.to raise_error 'Use distinct count for optimized distinct counting'
+ end
+
context 'in a transaction' do
let(:in_transaction) { true }