Commit 671c0c50 authored by Igor Drozdov's avatar Igor Drozdov

Merge branch '42639-remove-custom-metrics-license-check' into 'master'

Remove prometheus_custom_metrics license

See merge request gitlab-org/gitlab!28527
parents 7cc43072 4ff84f26
---
title: Move 'Additional Metrics' feature to GitLab Core
merge_request: 28527
author:
type: changed
......@@ -6,11 +6,6 @@ module EE
module MetricsController
extend ActiveSupport::Concern
prepended do
before_action :check_custom_metrics_license!,
only: [:validate_query, :index, :create, :update, :edit, :destroy]
end
def validate_query
respond_to do |format|
format.json do
......@@ -92,10 +87,6 @@ module EE
private
def check_custom_metrics_license!
render_404 unless project.feature_available?(:custom_prometheus_metrics)
end
def prometheus_metric
@prometheus_metric ||= ::PrometheusMetricsFinder.new(id: params[:id]).execute.first
end
......
......@@ -27,7 +27,7 @@ module EE
end
def custom_metrics_available?(project)
project.feature_available?(:custom_prometheus_metrics) && can?(current_user, :admin_project, project)
can?(current_user, :admin_project, project)
end
def metrics_data(project, environment)
......
......@@ -59,7 +59,6 @@ class License < ApplicationRecord
custom_file_templates
custom_file_templates_for_namespace
custom_project_templates
custom_prometheus_metrics
cycle_analytics_for_groups
db_load_balancing
default_project_deletion_protection
......
......@@ -14,20 +14,6 @@ describe Projects::Prometheus::MetricsController do
project.add_maintainer(user)
sign_in(user)
stub_licensed_features(custom_prometheus_metrics: true)
end
shared_context 'not found' do
before do
stub_licensed_features(custom_prometheus_metrics: false)
end
it 'renders 404' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
describe 'POST #validate_query' do
......@@ -56,21 +42,9 @@ describe Projects::Prometheus::MetricsController do
expect(response).to have_gitlab_http_status(:accepted)
end
end
context 'without premium license' do
subject { post :validate_query, params: project_params(format: :json, query: query) }
it_behaves_like 'not found'
end
end
describe 'GET #index' do
context 'without premium license' do
subject { get :index, params: project_params(format: :json) }
it_behaves_like 'not found'
end
context 'with custom metric present' do
let!(:prometheus_metric) { create(:prometheus_metric, project: project) }
......@@ -93,14 +67,6 @@ describe Projects::Prometheus::MetricsController do
end
describe 'POST #create' do
context 'without premium license' do
let(:metric) { { prometheus_metric: { title: 'title' } } }
subject { post :create, params: project_params(metric) }
it_behaves_like 'not found'
end
context 'metric is valid' do
let(:valid_metric) { { prometheus_metric: { title: 'title', query: 'query', group: 'business', y_label: 'label', unit: 'u', legend: 'legend' } } }
......@@ -126,14 +92,6 @@ describe Projects::Prometheus::MetricsController do
end
describe 'DELETE #destroy' do
context 'without premium license' do
let(:metric) { create(:prometheus_metric, project: project) }
subject { delete :destroy, params: project_params(id: metric.id) }
it_behaves_like 'not found'
end
context 'format html' do
let!(:metric) { create(:prometheus_metric, project: project) }
......
......@@ -17,8 +17,6 @@ describe 'Prometheus custom metrics', :js do
project.add_maintainer(user)
sign_in(user)
stub_licensed_features(custom_prometheus_metrics: true)
visit(project_settings_integrations_path(project))
click_link('Prometheus')
......
......@@ -28,7 +28,7 @@ describe EnvironmentsHelper do
expect(subject).to include(
'custom-metrics-path' => project_prometheus_metrics_path(project),
'validate-query-path' => validate_query_project_prometheus_metrics_path(project),
'custom-metrics-available' => 'false',
'custom-metrics-available' => 'true',
'alerts-endpoint' => project_prometheus_alerts_path(project, environment_id: environment.id, format: :json),
'prometheus-alerts-available' => 'true',
'logs_path' => project_logs_path(project, environment_name: environment.name)
......@@ -79,8 +79,6 @@ describe EnvironmentsHelper do
before do
project.add_maintainer(user)
stub_licensed_features(custom_prometheus_metrics: true)
allow(helper).to receive(:current_user).and_return(user)
allow(helper).to receive(:can?)
......
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