Commit 2373fb50 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add a test case for passing bridge variables downstream

parent 408248f4
...@@ -16,11 +16,11 @@ describe Ci::ProcessPipelineService, '#execute' do ...@@ -16,11 +16,11 @@ describe Ci::ProcessPipelineService, '#execute' do
describe 'cross-project pipelines' do describe 'cross-project pipelines' do
before do before do
create_processable(:ci_build, name: 'test', stage: 'test') create_processable(:build, name: 'test', stage: 'test')
create_processable(:ci_bridge, name: 'cross', create_processable(:bridge, :variables, name: 'cross',
stage: 'build', stage: 'build',
downstream: downstream) downstream: downstream)
create_processable(:ci_build, name: 'deploy', stage: 'deploy') create_processable(:build, name: 'deploy', stage: 'deploy')
stub_ci_pipeline_to_return_yaml_file stub_ci_pipeline_to_return_yaml_file
end end
...@@ -36,6 +36,9 @@ describe Ci::ProcessPipelineService, '#execute' do ...@@ -36,6 +36,9 @@ describe Ci::ProcessPipelineService, '#execute' do
expect(downstream.ci_pipelines).to be_one expect(downstream.ci_pipelines).to be_one
expect(downstream.ci_pipelines.first).to be_pending expect(downstream.ci_pipelines.first).to be_pending
expect(downstream.builds).not_to be_empty
expect(downstream.builds.first.variables)
.to include(key: 'BRIDGE', value: 'cross', public: false)
end end
end end
...@@ -51,12 +54,11 @@ describe Ci::ProcessPipelineService, '#execute' do ...@@ -51,12 +54,11 @@ describe Ci::ProcessPipelineService, '#execute' do
pipeline.builds.find_by(name: name).public_send(status) pipeline.builds.find_by(name: name).public_send(status)
end end
def create_processable(type, name:, **opts) def create_processable(type, *traits, **opts)
stages = %w[test build deploy] stages = %w[test build deploy]
index = stages.index(opts.fetch(:stage, 'test')) index = stages.index(opts.fetch(:stage, 'test'))
create(type, status: :created, create("ci_#{type}", *traits, status: :created,
name: name,
pipeline: pipeline, pipeline: pipeline,
stage_idx: index, stage_idx: index,
user: user, user: user,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment