Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-12 03:06:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-12 03:06:21 +0300
commit75687c79df805b57914d79cf217e3f08dbc77cc2 (patch)
treebff07aefc6467b8a7e00cd7649109fc6e8b7768f /spec/features/markdown
parent0c3f12149372a79b825d265a6c28dc547e4a1afc (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/markdown')
-rw-r--r--spec/features/markdown/metrics_spec.rb64
1 files changed, 44 insertions, 20 deletions
diff --git a/spec/features/markdown/metrics_spec.rb b/spec/features/markdown/metrics_spec.rb
index 580826f4a29..e7fec41fae3 100644
--- a/spec/features/markdown/metrics_spec.rb
+++ b/spec/features/markdown/metrics_spec.rb
@@ -4,6 +4,7 @@ require 'spec_helper'
describe 'Metrics rendering', :js, :use_clean_rails_memory_store_caching, :sidekiq_might_not_need_inline do
include PrometheusHelpers
+ include GrafanaApiHelpers
let(:user) { create(:user) }
let(:project) { create(:prometheus_project) }
@@ -14,11 +15,7 @@ describe 'Metrics rendering', :js, :use_clean_rails_memory_store_caching, :sidek
before do
configure_host
- import_common_metrics
- stub_any_prometheus_request_with_response
-
project.add_developer(user)
-
sign_in(user)
end
@@ -26,31 +23,58 @@ describe 'Metrics rendering', :js, :use_clean_rails_memory_store_caching, :sidek
restore_host
end
- it 'shows embedded metrics' do
- visit project_issue_path(project, issue)
+ context 'internal metrics embeds' do
+ before do
+ import_common_metrics
+ stub_any_prometheus_request_with_response
+ end
+
+ it 'shows embedded metrics' do
+ visit project_issue_path(project, issue)
+
+ expect(page).to have_css('div.prometheus-graph')
+ expect(page).to have_text('Memory Usage (Total)')
+ expect(page).to have_text('Core Usage (Total)')
+ end
+
+ context 'when dashboard params are in included the url' do
+ let(:metrics_url) { metrics_project_environment_url(project, environment, **chart_params) }
- expect(page).to have_css('div.prometheus-graph')
- expect(page).to have_text('Memory Usage (Total)')
- expect(page).to have_text('Core Usage (Total)')
+ let(:chart_params) do
+ {
+ group: 'System metrics (Kubernetes)',
+ title: 'Memory Usage (Pod average)',
+ y_label: 'Memory Used per Pod (MB)'
+ }
+ end
+
+ it 'shows embedded metrics for the specific chart' do
+ visit project_issue_path(project, issue)
+
+ expect(page).to have_css('div.prometheus-graph')
+ expect(page).to have_text(chart_params[:title])
+ expect(page).to have_text(chart_params[:y_label])
+ end
+ end
end
- context 'when dashboard params are in included the url' do
- let(:metrics_url) { metrics_project_environment_url(project, environment, **chart_params) }
+ context 'grafana metrics embeds' do
+ let(:grafana_integration) { create(:grafana_integration, project: project) }
+ let(:grafana_base_url) { grafana_integration.grafana_url }
+ let(:metrics_url) { valid_grafana_dashboard_link(grafana_base_url) }
- let(:chart_params) do
- {
- group: 'System metrics (Kubernetes)',
- title: 'Memory Usage (Pod average)',
- y_label: 'Memory Used per Pod (MB)'
- }
+ before do
+ stub_dashboard_request(grafana_base_url)
+ stub_datasource_request(grafana_base_url)
+ stub_all_grafana_proxy_requests(grafana_base_url)
end
- it 'shows embedded metrics for the specifiec chart' do
+ it 'shows embedded metrics' do
visit project_issue_path(project, issue)
expect(page).to have_css('div.prometheus-graph')
- expect(page).to have_text(chart_params[:title])
- expect(page).to have_text(chart_params[:y_label])
+ expect(page).to have_text('Expired / Evicted')
+ expect(page).to have_text('expired - test-attribute-value')
end
end