summaryrefslogtreecommitdiff
path: root/spec/features/markdown/metrics_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/markdown/metrics_spec.rb')
-rw-r--r--spec/features/markdown/metrics_spec.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/spec/features/markdown/metrics_spec.rb b/spec/features/markdown/metrics_spec.rb
index 9f00bb99c0d..1b68f78e993 100644
--- a/spec/features/markdown/metrics_spec.rb
+++ b/spec/features/markdown/metrics_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe 'Metrics rendering', :js, :kubeclient, :use_clean_rails_memory_store_caching, :sidekiq_inline, feature_category: :team_planning do
+RSpec.describe 'Metrics rendering', :js, :kubeclient, :use_clean_rails_memory_store_caching, :sidekiq_inline, feature_category: :metrics do
include PrometheusHelpers
include KubernetesHelpers
include GrafanaApiHelpers
@@ -29,6 +29,20 @@ RSpec.describe 'Metrics rendering', :js, :kubeclient, :use_clean_rails_memory_st
clear_host_from_memoized_variables
end
+ shared_examples_for 'metrics dashboard unavailable' do
+ context 'when metrics dashboard feature is unavailable' do
+ before do
+ stub_feature_flags(remove_monitor_metrics: true)
+ end
+
+ it 'shows no embedded metrics' do
+ visit project_issue_path(project, issue)
+
+ expect(page).to have_no_css('div.prometheus-graph')
+ end
+ end
+ end
+
context 'internal metrics embeds' do
before do
import_common_metrics
@@ -37,6 +51,8 @@ RSpec.describe 'Metrics rendering', :js, :kubeclient, :use_clean_rails_memory_st
allow(Prometheus::ProxyService).to receive(:new).and_call_original
end
+ include_examples 'metrics dashboard unavailable'
+
it 'shows embedded metrics' do
visit project_issue_path(project, issue)
@@ -135,6 +151,8 @@ RSpec.describe 'Metrics rendering', :js, :kubeclient, :use_clean_rails_memory_st
allow(Grafana::ProxyService).to receive(:new).and_call_original
end
+ include_examples 'metrics dashboard unavailable'
+
it 'shows embedded metrics', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/402973' do
visit project_issue_path(project, issue)
@@ -172,6 +190,8 @@ RSpec.describe 'Metrics rendering', :js, :kubeclient, :use_clean_rails_memory_st
stub_any_prometheus_request_with_response
end
+ include_examples 'metrics dashboard unavailable'
+
it 'shows embedded metrics' do
visit project_issue_path(project, issue)
@@ -201,6 +221,8 @@ RSpec.describe 'Metrics rendering', :js, :kubeclient, :use_clean_rails_memory_st
let(:metrics_url) { urls.namespace_project_cluster_url(*params, **query_params) }
let(:description) { "# Summary \n[](#{metrics_url})" }
+ include_examples 'metrics dashboard unavailable'
+
it 'shows embedded metrics' do
visit project_issue_path(project, issue)