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>2020-07-20 15:26:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 15:26:25 +0300
commita09983ae35713f5a2bbb100981116d31ce99826e (patch)
tree2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/features/markdown
parent18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff)
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/features/markdown')
-rw-r--r--spec/features/markdown/metrics_spec.rb38
1 files changed, 37 insertions, 1 deletions
diff --git a/spec/features/markdown/metrics_spec.rb b/spec/features/markdown/metrics_spec.rb
index 092408c2be0..3e63ae67f19 100644
--- a/spec/features/markdown/metrics_spec.rb
+++ b/spec/features/markdown/metrics_spec.rb
@@ -2,8 +2,9 @@
require 'spec_helper'
-RSpec.describe 'Metrics rendering', :js, :use_clean_rails_memory_store_caching, :sidekiq_inline do
+RSpec.describe 'Metrics rendering', :js, :kubeclient, :use_clean_rails_memory_store_caching, :sidekiq_inline do
include PrometheusHelpers
+ include KubernetesHelpers
include GrafanaApiHelpers
include MetricsDashboardUrlHelpers
@@ -166,6 +167,41 @@ RSpec.describe 'Metrics rendering', :js, :use_clean_rails_memory_store_caching,
end
end
+ context 'for GitLab embedded cluster health metrics' do
+ before do
+ project.add_maintainer(user)
+ import_common_metrics
+ stub_any_prometheus_request_with_response
+
+ allow(Prometheus::ProxyService).to receive(:new).and_call_original
+
+ create(:clusters_applications_prometheus, :installed, cluster: cluster)
+ stub_kubeclient_discover(cluster.platform.api_url)
+ stub_prometheus_request(/prometheus-prometheus-server/, body: prometheus_values_body)
+ stub_prometheus_request(/prometheus\/api\/v1/, body: prometheus_values_body)
+ end
+
+ let_it_be(:cluster) { create(:cluster, :provided_by_gcp, :project, projects: [project], user: user) }
+ let(:params) { [project.namespace.path, project.path, cluster.id] }
+ let(:query_params) { { group: 'Cluster Health', title: 'CPU Usage', y_label: 'CPU (cores)' } }
+ let(:metrics_url) { urls.namespace_project_cluster_url(*params, **query_params) }
+ let(:description) { "# Summary \n[](#{metrics_url})" }
+
+ it 'shows embedded metrics' do
+ visit project_issue_path(project, issue)
+
+ expect(page).to have_css('div.prometheus-graph')
+ expect(page).to have_text(query_params[:title])
+ expect(page).to have_text(query_params[:y_label])
+ expect(page).not_to have_text(metrics_url)
+
+ expect(Prometheus::ProxyService)
+ .to have_received(:new)
+ .with(cluster, 'GET', 'query_range', hash_including('start', 'end', 'step'))
+ .at_least(:once)
+ end
+ end
+
def import_common_metrics
::Gitlab::DatabaseImporters::CommonMetrics::Importer.new.execute
end