Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
fd1ba1894870
Commit
03478e6d
authored
Dec 29, 2015
by
Yorick Peterse
Browse files
Strip newlines from obfuscated SQL
Newlines aren't really needed and they may mess with InfluxDB's line protocol.
parent
fc998e922812
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/gitlab/metrics/obfuscated_sql.rb
View file @
fd1ba189
...
...
@@ -40,7 +40,7 @@ def to_s
sql
=
sql
.
delete
(
'"'
)
end
sql
sql
.
gsub
(
"
\n
"
,
' '
)
end
end
end
...
...
spec/lib/gitlab/metrics/obfuscated_sql_spec.rb
View file @
fd1ba189
...
...
@@ -2,6 +2,12 @@
describe
Gitlab
::
Metrics
::
ObfuscatedSQL
do
describe
'#to_s'
do
it
'replaces newlines with a space'
do
sql
=
described_class
.
new
(
"SELECT x
\n
FROM y"
)
expect
(
sql
.
to_s
).
to
eq
(
'SELECT x FROM y'
)
end
describe
'using single values'
do
it
'replaces a single integer'
do
sql
=
described_class
.
new
(
'SELECT x FROM y WHERE a = 10'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment