Fix PipelineTriggerService to associate trigger_request with builds

This commit is contained in:
Shinya Maeda 2017-09-13 17:02:26 +09:00
parent 373ff978df
commit 7338800787
2 changed files with 3 additions and 1 deletions

View file

@ -14,7 +14,7 @@ module Ci
pipeline = Ci::CreatePipelineService.new(project, trigger.owner, ref: params[:ref]) pipeline = Ci::CreatePipelineService.new(project, trigger.owner, ref: params[:ref])
.execute(:trigger, ignore_skip_ci: true) do |pipeline| .execute(:trigger, ignore_skip_ci: true) do |pipeline|
trigger.trigger_requests.create!(pipeline: pipeline) pipeline.trigger_requests.create!(trigger: trigger)
create_pipeline_variables!(pipeline) create_pipeline_variables!(pipeline)
end end

View file

@ -34,6 +34,8 @@ describe Ci::PipelineTriggerService do
expect(result[:pipeline].ref).to eq('master') expect(result[:pipeline].ref).to eq('master')
expect(result[:pipeline].project).to eq(project) expect(result[:pipeline].project).to eq(project)
expect(result[:pipeline].user).to eq(trigger.owner) expect(result[:pipeline].user).to eq(trigger.owner)
expect([result[:pipeline].trigger_requests.last])
.to eq(result[:pipeline].builds.map(&:trigger_request).uniq)
expect(result[:status]).to eq(:success) expect(result[:status]).to eq(:success)
end end