diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/lib/gitlab/query_limiting/transaction_spec.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/lib/gitlab/query_limiting/transaction_spec.rb')
-rw-r--r-- | spec/lib/gitlab/query_limiting/transaction_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/lib/gitlab/query_limiting/transaction_spec.rb b/spec/lib/gitlab/query_limiting/transaction_spec.rb index 76bb2b4c4cc..27da1f23556 100644 --- a/spec/lib/gitlab/query_limiting/transaction_spec.rb +++ b/spec/lib/gitlab/query_limiting/transaction_spec.rb @@ -78,6 +78,21 @@ RSpec.describe Gitlab::QueryLimiting::Transaction do expect { transaction.increment }.not_to change { transaction.count } end + + it 'does not increment the number of executed queries when the query is known to be ignorable' do + transaction = described_class.new + + expect do + transaction.increment(described_class::GEO_NODES_LOAD) + transaction.increment(described_class::LICENSES_LOAD) + transaction.increment('SELECT a.attname, a.other_column FROM pg_attribute a') + transaction.increment('SELECT x.foo, a.attname FROM some_table x JOIN pg_attribute a') + transaction.increment(<<-SQL) + SELECT a.attname, a.other_column + FROM pg_attribute a + SQL + end.not_to change(transaction, :count) + end end describe '#raise_error?' do |