summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorAndrew Newdigate <andrew@gitlab.com>2019-02-22 14:47:37 +0200
committerAndrew Newdigate <andrew@gitlab.com>2019-02-22 14:47:37 +0200
commitf78cd68ddf4513716b4f006428693756e04a6729 (patch)
treece971171bc7eb30e710c79b00258c0ef29d95ed5 /spec
parent24fb8cdae01e1e378b271b434a23dca93110ca00 (diff)
downloadgitlab-ce-f78cd68ddf4513716b4f006428693756e04a6729.tar.gz
Switch back to using regexps in `tracing_url_template`
This approach is able to cope with `%` characters in the URL template, which is important since `%` is a valid URL character. Additionally this approach is less likely to fail on an invalid string. This is important since the distributed tracing infrastructure is designed to degrade gracefully when not properly configured, and a small mistake in the configuration of the URL template could have led to a production outage.
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/tracing_spec.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/spec/lib/gitlab/tracing_spec.rb b/spec/lib/gitlab/tracing_spec.rb
index 8902d5f44ec..566b5050e47 100644
--- a/spec/lib/gitlab/tracing_spec.rb
+++ b/spec/lib/gitlab/tracing_spec.rb
@@ -44,13 +44,15 @@ describe Gitlab::Tracing do
describe '.tracing_url' do
where(:tracing_url_enabled?, :tracing_url_template, :correlation_id, :process_name, :tracing_url) do
- false | "https://localhost" | "123" | "web" | nil
- true | "https://localhost" | "123" | "web" | "https://localhost"
- true | "https://localhost?service=%{service}" | "123" | "web" | "https://localhost?service=web"
- true | "https://localhost?c=%{correlation_id}" | "123" | "web" | "https://localhost?c=123"
- true | "https://localhost?c=%{correlation_id}&s=%{service}" | "123" | "web" | "https://localhost?c=123&s=web"
- true | "https://localhost?c=%{correlation_id}" | nil | "web" | "https://localhost?c="
- true | "https://localhost?c=%{correlation_id}&s=%22%{service}%22" | "123" | "web" | "https://localhost?c=123&s=%22web%22"
+ false | "https://localhost" | "123" | "web" | nil
+ true | "https://localhost" | "123" | "web" | "https://localhost"
+ true | "https://localhost?service={{ service }}" | "123" | "web" | "https://localhost?service=web"
+ true | "https://localhost?c={{ correlation_id }}" | "123" | "web" | "https://localhost?c=123"
+ true | "https://localhost?c={{ correlation_id }}&s={{ service }}" | "123" | "web" | "https://localhost?c=123&s=web"
+ true | "https://localhost?c={{ correlation_id }}" | nil | "web" | "https://localhost?c="
+ true | "https://localhost?c={{ correlation_id }}&s=%22{{ service }}%22" | "123" | "web" | "https://localhost?c=123&s=%22web%22"
+ true | "https://localhost?c={{correlation_id}}&s={{service}}" | "123" | "web" | "https://localhost?c=123&s=web"
+ true | "https://localhost?c={{correlation_id }}&s={{ service}}" | "123" | "web" | "https://localhost?c=123&s=web"
end
with_them do