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:
authorReuben Pereira <rpereira@gitlab.com>2019-02-21 14:19:51 +0300
committerKamil TrzciƄski <ayufan@ayufan.eu>2019-02-21 14:19:51 +0300
commit536463295c2598505135bc61570ea66e1bad6496 (patch)
tree4bb61e295d682140d3c0cf8d9c3923e49e9e8e2b /spec/services
parent56b82db63a91695a1dec1b7cbf39636bb01ad3df (diff)
Catch exception in calculate reactive cache
Return the exception as an error.
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/error_tracking/list_issues_service_spec.rb26
-rw-r--r--spec/services/error_tracking/list_projects_service_spec.rb4
2 files changed, 25 insertions, 5 deletions
diff --git a/spec/services/error_tracking/list_issues_service_spec.rb b/spec/services/error_tracking/list_issues_service_spec.rb
index d9dab1d705c..9d4fc62f923 100644
--- a/spec/services/error_tracking/list_issues_service_spec.rb
+++ b/spec/services/error_tracking/list_issues_service_spec.rb
@@ -45,7 +45,23 @@ describe ErrorTracking::ListIssuesService do
it 'result is not ready' do
expect(result).to eq(
- status: :error, http_status: :no_content, message: 'not ready')
+ status: :error, http_status: :no_content, message: 'Not ready. Try again later')
+ end
+ end
+
+ context 'when list_sentry_issues returns error' do
+ before do
+ allow(error_tracking_setting)
+ .to receive(:list_sentry_issues)
+ .and_return(error: 'Sentry response status code: 401')
+ end
+
+ it 'returns the error' do
+ expect(result).to eq(
+ status: :error,
+ http_status: :bad_request,
+ message: 'Sentry response status code: 401'
+ )
end
end
end
@@ -58,7 +74,11 @@ describe ErrorTracking::ListIssuesService do
it 'returns error' do
result = subject.execute
- expect(result).to include(status: :error, message: 'access denied')
+ expect(result).to include(
+ status: :error,
+ message: 'Access denied',
+ http_status: :unauthorized
+ )
end
end
@@ -70,7 +90,7 @@ describe ErrorTracking::ListIssuesService do
it 'raises error' do
result = subject.execute
- expect(result).to include(status: :error, message: 'not enabled')
+ expect(result).to include(status: :error, message: 'Error Tracking is not enabled')
end
end
end
diff --git a/spec/services/error_tracking/list_projects_service_spec.rb b/spec/services/error_tracking/list_projects_service_spec.rb
index ee9c59e3f65..9f25a633deb 100644
--- a/spec/services/error_tracking/list_projects_service_spec.rb
+++ b/spec/services/error_tracking/list_projects_service_spec.rb
@@ -53,11 +53,11 @@ describe ErrorTracking::ListProjectsService do
context 'sentry client raises exception' do
before do
expect(error_tracking_setting).to receive(:list_sentry_projects)
- .and_raise(Sentry::Client::Error, 'Sentry response error: 500')
+ .and_raise(Sentry::Client::Error, 'Sentry response status code: 500')
end
it 'returns error response' do
- expect(result[:message]).to eq('Sentry response error: 500')
+ expect(result[:message]).to eq('Sentry response status code: 500')
expect(result[:http_status]).to eq(:bad_request)
end
end