diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /spec/controllers/projects/prometheus/alerts_controller_spec.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/controllers/projects/prometheus/alerts_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/prometheus/alerts_controller_spec.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/controllers/projects/prometheus/alerts_controller_spec.rb b/spec/controllers/projects/prometheus/alerts_controller_spec.rb index 6e3148231bd..cbd599506df 100644 --- a/spec/controllers/projects/prometheus/alerts_controller_spec.rb +++ b/spec/controllers/projects/prometheus/alerts_controller_spec.rb @@ -111,6 +111,7 @@ RSpec.describe Projects::Prometheus::AlertsController do describe 'GET #show' do let(:alert) do create(:prometheus_alert, + :with_runbook_url, project: project, environment: environment, prometheus_metric: metric) @@ -140,6 +141,7 @@ RSpec.describe Projects::Prometheus::AlertsController do 'query' => alert.query, 'operator' => alert.computed_operator, 'threshold' => alert.threshold, + 'runbook_url' => alert.runbook_url, 'alert_path' => alert_path(alert) } end @@ -225,7 +227,8 @@ RSpec.describe Projects::Prometheus::AlertsController do 'title' => metric.title, 'query' => metric.query, 'operator' => '>', - 'threshold' => 1.0 + 'threshold' => 1.0, + 'runbook_url' => 'https://sample.runbook.com' } end @@ -234,6 +237,7 @@ RSpec.describe Projects::Prometheus::AlertsController do opts, operator: '>', threshold: '1', + runbook_url: 'https://sample.runbook.com', environment_id: environment, prometheus_metric_id: metric ) @@ -250,14 +254,14 @@ RSpec.describe Projects::Prometheus::AlertsController do expect(json_response).to include(alert_params) end - it 'returns no_content for an invalid metric' do + it 'returns bad_request for an invalid metric' do make_request(prometheus_metric_id: 'invalid') - expect(response).to have_gitlab_http_status(:no_content) + expect(response).to have_gitlab_http_status(:bad_request) end it_behaves_like 'unprivileged' - it_behaves_like 'project non-specific environment', :no_content + it_behaves_like 'project non-specific environment', :bad_request end describe 'PUT #update' do @@ -304,6 +308,12 @@ RSpec.describe Projects::Prometheus::AlertsController do expect(json_response).to include(alert_params) end + it 'returns bad_request for an invalid alert data' do + make_request(runbook_url: 'bad-url') + + expect(response).to have_gitlab_http_status(:bad_request) + end + it_behaves_like 'unprivileged' it_behaves_like 'project non-specific environment', :not_found it_behaves_like 'project non-specific metric', :not_found |