blob: 5d2f3e98bb48c411d3a6ca4cce2e11188d6634a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Projects::Ci::PrometheusMetrics::HistogramsController' do
let_it_be(:project) { create(:project, :public) }
describe 'POST /*namespace_id/:project_id/-/ci/prometheus_metrics/histograms' do
context 'with known histograms' do
it 'returns 201 Created' do
post histograms_route(histograms: [
{ name: :pipeline_graph_link_calculation_duration_seconds, value: 1 },
{ name: :pipeline_graph_links_total, value: 10 }
])
expect(response).to have_gitlab_http_status(:created)
end
end
context 'with unknown histograms' do
it 'returns 404 Not Found' do
post histograms_route(histograms: [{ name: :chunky_bacon, value: 5 }])
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'with the feature flag disabled' do
before do
stub_feature_flags(ci_accept_frontend_prometheus_metrics: false)
end
it 'returns 202 Accepted' do
post histograms_route(histograms: [
{ name: :pipeline_graph_link_calculation_duration_seconds, value: 1 }
])
expect(response).to have_gitlab_http_status(:accepted)
end
end
end
def histograms_route(params = {})
namespace_project_ci_prometheus_metrics_histograms_path(namespace_id: project.namespace, project_id: project, **params)
end
end
|