diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-01-25 21:14:56 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-01-25 21:14:56 +0300 |
commit | 637894de8868b05499a275e1685621473addef58 (patch) | |
tree | 017f01e30effce8f80cfae61be5296e318f55cdb /spec | |
parent | 6cfe60df2275dace9804f4bc37b9746a9eadc6fd (diff) | |
parent | 31be74c74b72a1cd33e1630f9462ab5c43f2e319 (diff) |
Merge branch 'fix-ci-requests-concurrency' into 'master'
Fix CI requests concurrency
See merge request !8760
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/ci/api/builds_spec.rb | 14 | ||||
-rw-r--r-- | spec/services/ci/register_build_service_spec.rb | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/spec/requests/ci/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb index 270c23e3f19..8dbe5f0b025 100644 --- a/spec/requests/ci/api/builds_spec.rb +++ b/spec/requests/ci/api/builds_spec.rb @@ -91,6 +91,20 @@ describe Ci::API::Builds do expect { register_builds }.to change { runner.reload.contacted_at } end + context 'when concurrently updating build' do + before do + expect_any_instance_of(Ci::Build).to receive(:run!). + and_raise(ActiveRecord::StaleObjectError.new(nil, nil)) + end + + it 'returns a conflict' do + register_builds info: { platform: :darwin } + + expect(response).to have_http_status(409) + expect(response.headers).not_to have_key('X-GitLab-Last-Update') + end + end + context 'registry credentials' do let(:registry_credentials) do { 'type' => 'registry', diff --git a/spec/services/ci/register_build_service_spec.rb b/spec/services/ci/register_build_service_spec.rb index 27d7853bbdd..d9f774a1095 100644 --- a/spec/services/ci/register_build_service_spec.rb +++ b/spec/services/ci/register_build_service_spec.rb @@ -171,7 +171,7 @@ module Ci end def execute(runner) - described_class.new(runner).execute + described_class.new(runner).execute.build end end end |