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 ...@@ -23,7 +23,7 @@ module Gitlab
%r{ %r{
/environments /environments
/(?<environment>\d+) /(?<environment>\d+)
/metrics /(metrics_dashboard|metrics)
}x }x
) )
end end
......
...@@ -137,7 +137,7 @@ describe 'Metrics rendering', :js, :use_clean_rails_memory_store_caching, :sidek ...@@ -137,7 +137,7 @@ describe 'Metrics rendering', :js, :use_clean_rails_memory_store_caching, :sidek
end end
context 'transient metrics embeds' do 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(:title) { 'Important Metrics' }
let(:embed_json) do let(:embed_json) do
{ {
......
...@@ -3,17 +3,21 @@ ...@@ -3,17 +3,21 @@
require 'spec_helper' require 'spec_helper'
describe Gitlab::Metrics::Dashboard::Url do describe Gitlab::Metrics::Dashboard::Url do
include Gitlab::Routing.url_helpers
describe '#metrics_regex' do describe '#metrics_regex' do
let(:url) do let(:url_params) do
Gitlab::Routing.url_helpers.metrics_namespace_project_environment_url( [
'foo', 'foo',
'bar', 'bar',
1, 1,
{
start: '2019-08-02T05:43:09.000Z', start: '2019-08-02T05:43:09.000Z',
dashboard: 'config/prometheus/common_metrics.yml', dashboard: 'config/prometheus/common_metrics.yml',
group: 'awesome group', group: 'awesome group',
anchor: 'title' anchor: 'title'
) }
]
end end
let(:expected_params) do let(:expected_params) do
...@@ -29,12 +33,22 @@ describe Gitlab::Metrics::Dashboard::Url do ...@@ -29,12 +33,22 @@ describe Gitlab::Metrics::Dashboard::Url do
subject { described_class.metrics_regex } subject { described_class.metrics_regex }
context 'for metrics route' do
let(:url) { metrics_namespace_project_environment_url(*url_params) }
it_behaves_like 'regex which matches url when expected' it_behaves_like 'regex which matches url when expected'
end 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 describe '#grafana_regex' do
let(:url) do let(:url) do
Gitlab::Routing.url_helpers.namespace_project_grafana_api_metrics_dashboard_url( namespace_project_grafana_api_metrics_dashboard_url(
'foo', 'foo',
'bar', 'bar',
start: '2019-08-02T05:43:09.000Z', 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