diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-25 15:08:19 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-25 15:08:19 +0300 |
commit | e6baeabaa9651d90b03bb64ffce75a2c3cb89aab (patch) | |
tree | 85f3cbd6e437b17be59505cf3ac4794c1838609e /spec/models/project_services | |
parent | 5064bf8c5647d4c4430cbb4d097cf1592416de29 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/project_services')
-rw-r--r-- | spec/models/project_services/buildkite_service_spec.rb | 18 | ||||
-rw-r--r-- | spec/models/project_services/drone_ci_service_spec.rb | 4 |
2 files changed, 21 insertions, 1 deletions
diff --git a/spec/models/project_services/buildkite_service_spec.rb b/spec/models/project_services/buildkite_service_spec.rb index c622b7706c6..8b6fa36eaa5 100644 --- a/spec/models/project_services/buildkite_service_spec.rb +++ b/spec/models/project_services/buildkite_service_spec.rb @@ -84,6 +84,10 @@ describe BuildkiteService, :use_clean_rails_memory_store_caching do describe '#calculate_reactive_cache' do describe '#commit_status' do + let(:buildkite_full_url) do + 'https://gitlab.buildkite.com/status/secret-sauce-status-token.json?commit=123' + end + subject { service.calculate_reactive_cache('123', 'unused')[:commit_status] } it 'sets commit status to :error when status is 500' do @@ -103,13 +107,25 @@ describe BuildkiteService, :use_clean_rails_memory_store_caching do is_expected.to eq('Great Success') end + + Gitlab::HTTP::HTTP_ERRORS.each do |http_error| + it "sets commit status to :error with a #{http_error.name} error" do + WebMock.stub_request(:get, buildkite_full_url) + .to_raise(http_error) + + expect(Gitlab::ErrorTracking) + .to receive(:log_exception) + .with(instance_of(http_error), project_id: project.id) + + is_expected.to eq(:error) + end + end end end end def stub_request(status: 200, body: nil) body ||= %q({"status":"success"}) - buildkite_full_url = 'https://gitlab.buildkite.com/status/secret-sauce-status-token.json?commit=123' stub_full_request(buildkite_full_url) .to_return(status: status, diff --git a/spec/models/project_services/drone_ci_service_spec.rb b/spec/models/project_services/drone_ci_service_spec.rb index 0639a4c1f23..1ee9c5f90c6 100644 --- a/spec/models/project_services/drone_ci_service_spec.rb +++ b/spec/models/project_services/drone_ci_service_spec.rb @@ -106,6 +106,10 @@ describe DroneCiService, :use_clean_rails_memory_store_caching do WebMock.stub_request(:get, commit_status_path) .to_raise(http_error) + expect(Gitlab::ErrorTracking) + .to receive(:log_exception) + .with(instance_of(http_error), project_id: project.id) + is_expected.to eq(:error) end end |