summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-01 19:43:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-01 19:43:42 +0000
commit8f3fbbf0d56091ad87158f61bf2a4e96a7f937e3 (patch)
tree6749b899adc622297e0443084ef6fd1909fffd00 /spec
parentde235133e1f8b318b0ee6f49269e576b6e969486 (diff)
downloadgitlab-ce-8f3fbbf0d56091ad87158f61bf2a4e96a7f937e3.tar.gz
Add latest changes from gitlab-org/gitlab@13-12-stable-ee
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/error_tracking_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/lib/gitlab/error_tracking_spec.rb b/spec/lib/gitlab/error_tracking_spec.rb
index 7ad1f52780a..b3293e6473c 100644
--- a/spec/lib/gitlab/error_tracking_spec.rb
+++ b/spec/lib/gitlab/error_tracking_spec.rb
@@ -204,6 +204,23 @@ RSpec.describe Gitlab::ErrorTracking do
expect(sentry_event.dig('extra', 'sql')).to eq('SELECT "users".* FROM "users" WHERE "users"."id" = $2 AND "users"."foo" = $1')
end
+
+ context 'when SQL cannot be parsed' do
+ let(:pg12_query) do
+ <<-SQL
+ CREATE INDEX CONCURRENTLY my_index ON merge_requests
+ USING btree (target_project_id) INCLUDE (id, latest_merge_request_diff_id)
+ SQL
+ end
+
+ let(:exception) { ActiveRecord::StatementInvalid.new(sql: pg12_query) }
+
+ it 'injects the raw sql query into extra' do
+ track_exception
+
+ expect(sentry_event.dig('extra', 'sql')).to eq(pg12_query)
+ end
+ end
end
context 'when the `ActiveRecord::StatementInvalid` is wrapped in another exception' do