diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-01-24 22:30:38 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-01-25 10:49:36 +0100 |
commit | 3234741576ef8b0ad02dd4fcfbd294c41430f8d7 (patch) | |
tree | 93529d0467ea4952511dc55e0caa905935bb31dc /spec/requests/ci | |
parent | 7fe16110a1b6c567c00c6b1ccfcacbab41ab0b4d (diff) | |
download | gitlab-ce-3234741576ef8b0ad02dd4fcfbd294c41430f8d7.tar.gz |
Add 409 conflict testsfix-ci-requests-concurrency
Diffstat (limited to 'spec/requests/ci')
-rw-r--r-- | spec/requests/ci/api/builds_spec.rb | 14 |
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', |