summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/metrics
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-12 12:09:01 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-12 12:09:01 +0000
commitbd497e352ebd279536ae11855871162e82a3f88c (patch)
tree2241444d4be33e199d7011b872713071a8f8cd41 /spec/lib/gitlab/metrics
parent0388886f9439fa93efea29a159522aec5643f7c8 (diff)
downloadgitlab-ce-bd497e352ebd279536ae11855871162e82a3f88c.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/metrics')
-rw-r--r--spec/lib/gitlab/metrics/dashboard/url_spec.rb42
1 files changed, 4 insertions, 38 deletions
diff --git a/spec/lib/gitlab/metrics/dashboard/url_spec.rb b/spec/lib/gitlab/metrics/dashboard/url_spec.rb
index daaf66cba46..d98aa5e3697 100644
--- a/spec/lib/gitlab/metrics/dashboard/url_spec.rb
+++ b/spec/lib/gitlab/metrics/dashboard/url_spec.rb
@@ -3,38 +3,6 @@
require 'spec_helper'
describe Gitlab::Metrics::Dashboard::Url do
- shared_examples_for 'a regex which matches the expected url' do
- it { is_expected.to be_a Regexp }
-
- it 'matches a metrics dashboard link with named params' do
- expect(subject).to match url
-
- subject.match(url) do |m|
- expect(m.named_captures).to eq expected_params
- end
- end
- end
-
- shared_examples_for 'does not match non-matching urls' do
- it 'does not match other gitlab urls that contain the term metrics' do
- url = Gitlab::Routing.url_helpers.active_common_namespace_project_prometheus_metrics_url('foo', 'bar', :json)
-
- expect(subject).not_to match url
- end
-
- it 'does not match other gitlab urls' do
- url = Gitlab.config.gitlab.url
-
- expect(subject).not_to match url
- end
-
- it 'does not match non-gitlab urls' do
- url = 'https://www.super_awesome_site.com/'
-
- expect(subject).not_to match url
- end
- end
-
describe '#regex' do
let(:url) do
Gitlab::Routing.url_helpers.metrics_namespace_project_environment_url(
@@ -59,10 +27,9 @@ describe Gitlab::Metrics::Dashboard::Url do
}
end
- subject { described_class.regex }
+ subject { described_class.metrics_regex }
- it_behaves_like 'a regex which matches the expected url'
- it_behaves_like 'does not match non-matching urls'
+ it_behaves_like 'regex which matches url when expected'
end
describe '#grafana_regex' do
@@ -89,15 +56,14 @@ describe Gitlab::Metrics::Dashboard::Url do
subject { described_class.grafana_regex }
- it_behaves_like 'a regex which matches the expected url'
- it_behaves_like 'does not match non-matching urls'
+ it_behaves_like 'regex which matches url when expected'
end
describe '#build_dashboard_url' do
it 'builds the url for the dashboard endpoint' do
url = described_class.build_dashboard_url('foo', 'bar', 1)
- expect(url).to match described_class.regex
+ expect(url).to match described_class.metrics_regex
end
end
end