diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-12 16:26:10 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-12 16:26:10 +0000 |
commit | 6653ccc011dec86e5140a5d09ea3b2357eab6714 (patch) | |
tree | 897193f37bcd98152a0ac214f80a3c4cfe1047c5 /spec/lib/gitlab/query_limiting/transaction_spec.rb | |
parent | bff35a05aed6a31380a73c39113808fd262c2c37 (diff) | |
download | gitlab-ce-6653ccc011dec86e5140a5d09ea3b2357eab6714.tar.gz |
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc41
Diffstat (limited to 'spec/lib/gitlab/query_limiting/transaction_spec.rb')
-rw-r--r-- | spec/lib/gitlab/query_limiting/transaction_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/lib/gitlab/query_limiting/transaction_spec.rb b/spec/lib/gitlab/query_limiting/transaction_spec.rb index 331c3c1d8b0..40804736b86 100644 --- a/spec/lib/gitlab/query_limiting/transaction_spec.rb +++ b/spec/lib/gitlab/query_limiting/transaction_spec.rb @@ -118,6 +118,30 @@ RSpec.describe Gitlab::QueryLimiting::Transaction do ) end + it 'includes a list of executed queries' do + transaction = described_class.new + transaction.count = max = described_class::THRESHOLD + %w[foo bar baz].each { |sql| transaction.executed_sql(sql) } + + message = transaction.error_message + + expect(message).to start_with( + "Too many SQL queries were executed: a maximum of #{max} " \ + "is allowed but #{max} SQL queries were executed" + ) + + expect(message).to include("0: foo", "1: bar", "2: baz") + end + + it 'indicates if the log is truncated' do + transaction = described_class.new + transaction.count = described_class::THRESHOLD * 2 + + message = transaction.error_message + + expect(message).to end_with('...') + end + it 'includes the action name in the error message when present' do transaction = described_class.new transaction.count = max = described_class::THRESHOLD |