summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-06-01 13:31:52 -0500
committerDouwe Maan <douwe@selenight.nl>2017-06-01 13:31:52 -0500
commit94be44c568b0167bbcc1e975ab674747a8271dbc (patch)
treec5130a2d2780eb155190f84abf4e8e48fe3e0b6f /spec/services
parent42c13b26dab4f52e90bc8be2b6f46d2ef9559ccd (diff)
downloadgitlab-ce-94be44c568b0167bbcc1e975ab674747a8271dbc.tar.gz
Fix race condition between pipeline creation and MR diff_head_sha update
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/ci/create_pipeline_service_spec.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb
index 8bf02f56282..06fbd7bad90 100644
--- a/spec/services/ci/create_pipeline_service_spec.rb
+++ b/spec/services/ci/create_pipeline_service_spec.rb
@@ -72,10 +72,11 @@ describe Ci::CreatePipelineService, services: true do
end
end
- context 'when merge request head commit sha does not match pipeline sha' do
+ context 'when the pipeline is not the latest for the branch' do
it 'does not update merge request head pipeline' do
merge_request = create(:merge_request, source_branch: 'master', target_branch: "branch_1", source_project: project)
- allow_any_instance_of(MergeRequestDiff).to receive(:head_commit).and_return(double(id: 1234))
+
+ allow_any_instance_of(Ci::Pipeline).to receive(:latest?).and_return(false)
pipeline