Commit 753f1b8c authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'sy-fix-transient-embed-again' into 'master'

Match both metrics and metrics dashboard embeds in entirety

See merge request gitlab-org/gitlab!29838
parents 2607cff7 83a438dd
---
title: Embed metrics charts for both /metrics and /metrics_dashboard routes
merge_request: 29838
author:
type: fixed
......@@ -23,7 +23,7 @@ module Gitlab
%r{
/environments
/(?<environment>\d+)
/metrics
/(metrics_dashboard|metrics)
}x
)
end
......
......@@ -137,7 +137,7 @@ describe 'Metrics rendering', :js, :use_clean_rails_memory_store_caching, :sidek
end
context 'transient metrics embeds' do
let(:metrics_url) { urls.metrics_project_environment_url(project, environment, embed_json: embed_json) }
let(:metrics_url) { urls.metrics_dashboard_project_environment_url(project, environment, embed_json: embed_json) }
let(:title) { 'Important Metrics' }
let(:embed_json) do
{
......
......@@ -3,17 +3,21 @@
require 'spec_helper'
describe Gitlab::Metrics::Dashboard::Url do
include Gitlab::Routing.url_helpers
describe '#metrics_regex' do
let(:url) do
Gitlab::Routing.url_helpers.metrics_namespace_project_environment_url(
let(:url_params) do
[
'foo',
'bar',
1,
start: '2019-08-02T05:43:09.000Z',
dashboard: 'config/prometheus/common_metrics.yml',
group: 'awesome group',
anchor: 'title'
)
{
start: '2019-08-02T05:43:09.000Z',
dashboard: 'config/prometheus/common_metrics.yml',
group: 'awesome group',
anchor: 'title'
}
]
end
let(:expected_params) do
......@@ -29,12 +33,22 @@ describe Gitlab::Metrics::Dashboard::Url do
subject { described_class.metrics_regex }
it_behaves_like 'regex which matches url when expected'
context 'for metrics route' do
let(:url) { metrics_namespace_project_environment_url(*url_params) }
it_behaves_like 'regex which matches url when expected'
end
context 'for metrics_dashboard route' do
let(:url) { metrics_dashboard_namespace_project_environment_url(*url_params) }
it_behaves_like 'regex which matches url when expected'
end
end
describe '#grafana_regex' do
let(:url) do
Gitlab::Routing.url_helpers.namespace_project_grafana_api_metrics_dashboard_url(
namespace_project_grafana_api_metrics_dashboard_url(
'foo',
'bar',
start: '2019-08-02T05:43:09.000Z',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment