diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-11 15:12:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-11 15:12:30 +0300 |
commit | 0b54f87a31c23544ca5917bf772ce9c64a61562c (patch) | |
tree | 79d56df6750e84fd4a10205d9dcce293f7c5d491 /spec/controllers | |
parent | e348fb4c1b9eaf21655001dc4346ceb0c0c3d5b4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/grafana_api_controller_spec.rb | 9 | ||||
-rw-r--r-- | spec/controllers/projects/performance_monitoring/dashboards_controller_spec.rb | 30 |
2 files changed, 38 insertions, 1 deletions
diff --git a/spec/controllers/projects/grafana_api_controller_spec.rb b/spec/controllers/projects/grafana_api_controller_spec.rb index 7c74511e5b4..fa20fc5037f 100644 --- a/spec/controllers/projects/grafana_api_controller_spec.rb +++ b/spec/controllers/projects/grafana_api_controller_spec.rb @@ -15,6 +15,7 @@ RSpec.describe Projects::GrafanaApiController, feature_category: :metrics do end before do + stub_feature_flags(remove_monitor_metrics: false) sign_in(user) if user end @@ -170,6 +171,14 @@ RSpec.describe Projects::GrafanaApiController, feature_category: :metrics do it_behaves_like 'accessible' end end + + context 'when metrics dashboard feature is unavailable' do + before do + stub_feature_flags(remove_monitor_metrics: true) + end + + it_behaves_like 'not accessible' + end end describe 'GET #metrics_dashboard' do diff --git a/spec/controllers/projects/performance_monitoring/dashboards_controller_spec.rb b/spec/controllers/projects/performance_monitoring/dashboards_controller_spec.rb index dc59dda3322..02407e31756 100644 --- a/spec/controllers/projects/performance_monitoring/dashboards_controller_spec.rb +++ b/spec/controllers/projects/performance_monitoring/dashboards_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::PerformanceMonitoring::DashboardsController do +RSpec.describe Projects::PerformanceMonitoring::DashboardsController, feature_category: :metrics do let_it_be(:user) { create(:user) } let_it_be(:namespace) { create(:namespace) } @@ -25,6 +25,10 @@ RSpec.describe Projects::PerformanceMonitoring::DashboardsController do } end + before do + stub_feature_flags(remove_monitor_metrics: false) + end + describe 'POST #create' do context 'authenticated user' do before do @@ -102,6 +106,18 @@ RSpec.describe Projects::PerformanceMonitoring::DashboardsController do expect(json_response).to eq('error' => "Request parameter branch is missing.") end end + + context 'when metrics dashboard feature is unavailable' do + before do + stub_feature_flags(remove_monitor_metrics: true) + end + + it 'returns 404 not found' do + post :create, params: params + + expect(response).to have_gitlab_http_status :not_found + end + end end end end @@ -217,6 +233,18 @@ RSpec.describe Projects::PerformanceMonitoring::DashboardsController do expect(json_response).to eq('error' => 'something went wrong') end end + + context 'when metrics dashboard feature is unavailable' do + before do + stub_feature_flags(remove_monitor_metrics: true) + end + + it 'returns 404 not found' do + put :update, params: params + + expect(response).to have_gitlab_http_status :not_found + end + end end end |