summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2017-01-25 18:14:56 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2017-01-25 18:14:56 +0000
commit637894de8868b05499a275e1685621473addef58 (patch)
tree017f01e30effce8f80cfae61be5296e318f55cdb /spec/requests
parent6cfe60df2275dace9804f4bc37b9746a9eadc6fd (diff)
parent31be74c74b72a1cd33e1630f9462ab5c43f2e319 (diff)
downloadgitlab-ce-637894de8868b05499a275e1685621473addef58.tar.gz
Merge branch 'fix-ci-requests-concurrency' into 'master'
Fix CI requests concurrency See merge request !8760
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/ci/api/builds_spec.rb14
1 files changed, 14 insertions, 0 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',